bernhard-42 / vscode-ocp-cad-viewer

A viewer for OCP based Code-CAD (CadQuery, build123d) integrated into VS Code
Apache License 2.0
80 stars 9 forks source link

View should not be reset between runs when `set_defaults(reset_camera=Camera.KEEP)` #31

Closed qwelyt closed 7 months ago

qwelyt commented 10 months ago

Small example

from ocp_vscode import show, show_object, reset_show, set_port, set_defaults, get_defaults, Camera
set_port(3939)
set_defaults(reset_camera=Camera.KEEP)

import build123d as bd

part = bd.Box(10,20,30)

#show(part) # Resets the view even though defaults are set
show(part, reset_camera=Camera.KEEP) # Respects the camera setting

The second show command does not reset the view between runs of this code. The first one does however. I would expect them both to respect the settings of the camera, even between full runs of the file.

As was discussed on cadquery-discord, this is meant to be used in jupyter-mode. I think it would be of value if this is respected no matter what "mode" you use. This tripped me up, and I would think I'm not alone in that. This is the first editor that I use that resets the view on every re-render.

So - I would like it if possible to have the camera-setting be respected when set with set_defaults even when not using jupyter-mode.

MatthiasJ1 commented 9 months ago

To add to this, show_all resets the camera even if show_all(reset_camera=Camera.KEEP) is specified.

bernhard-42 commented 7 months ago

Fixed in 2.0.13 for show and show_all