Skip to content

Conversation

@winksaville
Copy link
Contributor

  • 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.
@winksaville
Copy link
Contributor Author

I've added this per the suggestion from @adam-urbanczyk in "Enhance show in vis.py" discussion #1844.

@codecov
Copy link

codecov bot commented Jun 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.66%. Comparing base (f07e7e0) to head (58e52a1).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@winksaville
Copy link
Contributor Author

Anyone have any thoughts on this PR?

@adam-urbanczyk
Copy link
Member

Pls give it some time.

camera = renderer.GetActiveCamera()

# Reset orientation to known state
renderer.ResetCamera()
Copy link
Member

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),
)

Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants