Migration from 4.x¶
What a notebook written for Jupyter CadQuery 4 meets in 5.1. The full list of changes is in the changelog.
Changed behaviour¶
- A sidecar viewer fills its panel. For a viewer of a fixed shape, as in 4.x, give
open_viewerbothcad_widthandheight— together they set the aspect ratio. See Managing viewers. showkeeps the camera. The default isreset_camera=Camera.KEEP— unless your~/.jcq_configsays otherwise, see below. The viewer warns when the new object is much larger or smaller than the view;ignore_camera_warnings()silences the warnings. For the 4.x behaviour useset_defaults(reset_camera=Camera.RESET), orreset_camera=Camera.RESETper call. See Keeping the camera orientation.ticksdefaults to 5 (was 10), as in the other viewers.modifier_keysis one map per platform and gainsalt. On Windows and Linux,metais the Alt key andaltthe Windows key by default. See Mouse and Keys.- The tree remembers what you hid. Paths hidden or shown in the tree stay hidden or shown when the next
showrenders an object with the same paths. -
from jupyter_cadquery import *still works. For code that runs unchanged under every viewer of the family, import fromocp_viewer_core.viewerinstead — it picks the viewer of the environment it runs in:from ocp_viewer_core.viewer import *
An existing ~/.jcq_config¶
The file stores every setting it knows, so a ~/.jcq_config written by 4.x still holds reset_camera: reset, ticks: 10 and a three-key modifier_keys, and these stored values win over the new defaults. Delete the file — it is rewritten from the defaults on next use — or edit the three entries. See Workspace Config.
Removed and deprecated¶
mate_scaleis gone; usehelper_scale.reset_camera=Trueis deprecated; useCamera.RESET.-
AnimationTrackwithcv.add_track(...)andcv.animate(...)still works but warns. Animation is the sharedAnimationclass now, as in every other viewer — see Animation:from jupyter_cadquery import Animation animation = Animation() animation.add_track("/bottom/left_front", "rz", times, values) animation.animate(speed=3) -
ocp_vscodeis no longer installed with Jupyter CadQuery. Its standalone viewer,python -m ocp_vscode, is the separate OCP Viewer package now.