-
Notifications
You must be signed in to change notification settings - Fork 441
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
Add add_ruler to BasePlotter #2531
Conversation
ruler.SetMinorTickLength(minor_tick_length) | ||
ruler.SetTickOffset(tick_label_offset) | ||
|
||
self.add_actor(ruler, reset_camera=True, pickable=False) |
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.
I used reset_camera=True
here, but it doesn't seem to do anything. If the users picks pointa
and pointb
to be outside the normal viewing area, it won't resize based on the choice here. Probably because of the 2D overlay nature of this actor.
If this can't be fixed, we can just put in a note in the docstring about this.
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.
One way you could work around this is adding fictitious points and then removing them to get the camera to increase the bounds. If this is out of the scope of the PR or you feel it's too complex, you can just add a note in the docstring.
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.
I tried this without success, so I added in a note.
tmp_points = pyvista.PolyData([pointa, pointb])
tmp_actor = self.add_mesh(tmp_points, reset_camera=True)
self.remove_actor(tmp_actor, reset_camera=False)
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.
If I get rid of self.remove_actor
then the camera does reset as expected, but then it leaves behind the fictituous points. It seems that reset_camera=False
isn't working quite correctly in this case?
Codecov Report
@@ Coverage Diff @@
## main #2531 +/- ##
==========================================
- Coverage 93.72% 93.71% -0.01%
==========================================
Files 75 75
Lines 16116 16145 +29
==========================================
+ Hits 15105 15131 +26
- Misses 1011 1014 +3 |
I had to use the functionality in I considered exposing the |
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.
This is good as-is; you can choose to supplement the methods with docstrings for the limitations of the vtkAxisActor2D
.
Overview
This PR adds
add_ruler
functionality to the plotter usingvtkAxisActor2D
.This is useful for adding customizable scale or measurements to the scene.
Edit: Updated image using
flip_range
.TODO: