Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to change the default view? #90

Open
snapo opened this issue Sep 9, 2022 · 6 comments
Open

Is it possible to change the default view? #90

snapo opened this issue Sep 9, 2022 · 6 comments
Labels
bug Something isn't working

Comments

@snapo
Copy link

snapo commented Sep 9, 2022

Hi,
When i generate in cadquery code the view differs from the freecad view. Is it possible to adjust the perspective of the panes?
Re-assign (1) the views of the panes to my preferred axis
Re-assign (2) the iso view default coordinates

image

Currently i have to rotate the object to get the same behavior as in FreeCad. It works, but everytime i resize the window i have to click and drag to get the view correct and see the front. This generates a lot lot more click and i would like to prevent that.
Or are there some other ideas how i might solve this?

(Everytime i move the window, or do a change, or re-render it... i have to rotate the object with the mouse again)
image

Code Sample:

import cadquery as cq
from cq_server.ui import UI, show_object


height = 150.0
width = 50.0
depth = 100.0

r = cq.Workplane("front").box(width,height,depth)

r = r + cq.Workplane('top').text("YX / Top", 8, (height / 2) + 1)
r = r + cq.Workplane('bottom').text("XY / Bottom", 8, (height / 2) + 1)
r = r + cq.Workplane('front').text("ZX / Front", 8, (depth / 2) + 1)
r = r + cq.Workplane('back').text("XZ / Back", 8, (depth / 2) + 1)
r = r + cq.Workplane('left').text("ZY / Left", 8, (width / 2) + 1)
r = r + cq.Workplane('right').text("YZ / Right", 8, (width / 2) + 1)

r = r.rotate((0, 0, 0), (1, 0, 0), 90)
r = r.rotate((0, 0, 0), (1, 0, 180), 0)
show_object(r)
@bernhard-42
Copy link
Owner

@snapo From the screenshot I derive, you are using cadquery-server, right?
Jupyter-Cadquery shares the viewer (three-cad-viewer), however has nothing to do with cadquery-server.

Nevertheless, I think, these are three issues:

  1. Resizing browser window resets camera => needs to be fixed by cadquery-server
  2. A different camera position for the isometric view
  3. Swap back/front with left/right orientation button view to align with cadquery workplanes

Point 1 seems to be on the roadmap roipoussiere/cadquery-server#37
Point 2 and 3 I will look into in the next release. It is an issue in three-cad-viewer, however bubbles up to Jupyter Cadquery

@bernhard-42 bernhard-42 added the bug Something isn't working label Sep 11, 2022
@snapo
Copy link
Author

snapo commented Sep 11, 2022

Hi,
Yes correct it is for the cadquery-server (i did think its the same :-( my fault).
Would you like me to close the feature request and create one in the cadquery server?

@bernhard-42
Copy link
Owner

Let's keep it open to track points 2 and 3.

For the future, the dependencies are:

jupyter-cadquery --> cad-viewer-widget --\
                                          |--> three-cad-viewer
cadquery-server -------------------------/

jupyter-cadquery, cad-viewer-widget and three-cad-viewer are my projects, cadquery-server is maintained by @roipoussiere. I'd recommend to always first open an issue with cadquery-server since much of the logic "around" the viewer component is implemented there.

@roipoussiere
Copy link
Contributor

(Everytime i move the window, or do a change, or re-render it... i have to rotate the object with the mouse again)

Yes, after using cq-server, I confirm it's really annoying, that's why I created the issue linked by bernhard.

Yes correct it is for the cadquery-server (i did think its the same :-( my fault).

You are not the first person to be confused here. There is a note about this on the cq-server readme, but it might be necessary to make it more visible, maybe at the very first lines of the readme and in the project description.

@bernhard-42
Copy link
Owner

@snapo v3.3.0 of Jupyter CadQuery is out and should now per default behave like FreeCAD (as you described above).
It dependes on three-cad-viewer 1.7.0 , which @roipoussiere would need to integrate first before this change is visible in cq-server

@roipoussiere
Copy link
Contributor

I updated three-cad-viewer to v1.7.0 in last commit.
You must install from source to see the changes (see readme), or wait for 0.4.1 which should be released in the next days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants