-
Notifications
You must be signed in to change notification settings - Fork 385
feat: Enhance vis.py show routine #1855
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
base: master
Are you sure you want to change the base?
Conversation
winksaville
commented
Jun 3, 2025
- Add parameters azimuth viewup and clipping_range to allow for improved control of the rendering.
- Always call ResetCamera early so the camera is in a known state before applying user defined parameters, some of which are relative.
- Add parameters azimuth viewup and clipping_range to allow for improved control of the rendering. - Always call ResetCamera early so the camera is in a known state before applying user defined parameters, some of which are relative.
|
I've added this per the suggestion from @adam-urbanczyk in "Enhance show in vis.py" discussion #1844. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1855 +/- ##
=======================================
Coverage 95.66% 95.66%
=======================================
Files 28 28
Lines 7431 7435 +4
Branches 1122 1123 +1
=======================================
+ Hits 7109 7113 +4
Misses 193 193
Partials 129 129 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
a11b8d2 to
58e52a1
Compare
|
Anyone have any thoughts on this PR? |
|
Pls give it some time. |
| camera = renderer.GetActiveCamera() | ||
|
|
||
| # Reset orientation to known state | ||
| renderer.ResetCamera() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my test I find ResetCamera must be called later, otherwise I get an empty display until I interacte with the viewer window.
from cadquery.func import *
from cadquery.vis import show
r = loft(face(circle(5)), vertex(0, 0, 10))
show(
r,
roll=0,
elevation=0,
viewup=(0, 0, 1),
position=(0, -60, 10),
focus=(0, 0, 10),
)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you say it must be called later, when did you call it to make it work?
If you just used the original code than I don't think ResetCamera() is called at all because you're passing position and focus and if either is passed ResetCamera() isn't invoked in the original code.
I decided to always call ResetCamera() so we start with "all" variables with known values and then update the camera with the various passed parameters. So my guess is that there is something we need to do to "complete" the initialization, but no idea what that would be.