Axe update #586
Replies: 10 comments 50 replies
-
Hi @jsaintauret at present
|
Beta Was this translation helpful? Give feedback.
-
hi - sorry I overlooked your second question..
yes - in a callback function you can access the |
Beta Was this translation helpful? Give feedback.
-
Hello, I'm having a hard time figuring how to update the axes range value of my mesh. In the picture, you can see that the range of my mesh for the x,y,z axis is [0,1000]. For the z-axis it is perfectly fine because my data values is in that range, but since the x and y value are very small compared to the z value (x range [0,16] | y range [0,44] ) I had to scale all the x and y coordinate point of my mesh as follow, so the render could be readable : I would like to know if there is a way of changing the range value displayed on the x-axis and y-axis in the same way addElevationScalars would do on the Z-axis ? I've tried to play with the xrange and yrange arguments of the Axes class but from my understanding, it only changes the size of the axes line according to the defined range selected. On Pyvista you can use the show_bounds method of the plotter to override the mesh bounds in the form [xmin, xmax, ymin, ymax, zmin, zmax]. https://docs.pyvista.org/api/plotting/_autosummary/pyvista.Plotter.show_bounds.html Thanks |
Beta Was this translation helpful? Give feedback.
-
In this example you can see how to remove and update the axes: you should see a sphere "walking" in x-y while the axes are updated (ignore the timer mechanism if you don't need it): import time
from vedo import Plotter, Sphere, Axes
def bfunc():
global timerId
plotter.timerCallback("destroy", timerId)
if "Play" in button.status():
timerId = plotter.timerCallback("create", dt=10)
button.switch()
def handle_timer(event):
t = time.time() - t0
sph.pos(t,t)
axe = Axes(sph)
# remove the old and add the new one
plotter.remove("Axes").add(axe).resetCamera()
timerId = None
t0 = time.time()
plotter= Plotter()
button = plotter.addButton(bfunc, states=[" Play ","Pause"], size=40)
evntId = plotter.addCallback("timer", handle_timer)
sph = Sphere()
plotter += sph
plotter.show().close() |
Beta Was this translation helpful? Give feedback.
-
not at all, no worries! It looks to that your mesh genuinely starts at about x=25 in the world coordinates, while you are creating the axes in a different range. Forget the So i'm not sure what could be the problem... I cannot make a more informative guess.. |
Beta Was this translation helpful? Give feedback.
-
ps |
Beta Was this translation helpful? Give feedback.
-
Hi, Thanks again clipping.mp4 |
Beta Was this translation helpful? Give feedback.
-
You are right! Infact I will change the default behavior of this method.... for the next release! |
Beta Was this translation helpful? Give feedback.
-
Hello Marco, Here is a quick update on what I was trying to do with the axe update, I manage to do something pretty cool so here a small demo clip of my app (I'm not set yet on the GUI part for the plotter/axe property option) Screenshare.-.2022-05-15.11_18_25.AM.1.mp4I do have a question though, is there a way to place the y axis line at the opposite side ? like what we can do with the grid plane (yzGrid2). By the way you told me that the last tick value is always dropped, so I need to put it twice in my list . I did that but it doesn't seems to change anything. |
Beta Was this translation helpful? Give feedback.
-
Hi I didn't realize that I was working with vedo 2022.1.0 so I updated to the last revision and something weird happened. Did you change anything on regarding the Mesh class ? |
Beta Was this translation helpful? Give feedback.
-
Hello everyone!
I am working on a post-processing tool to visualize data from chemical analysis. At the moment I'm using Pyvista to visualize data as 3D mesh surface plot. To make it short and to give you a quick overlook at what the tool does, is that I create with NumPy three X , Y , Z matrices of size nxm with the meshgrid function then feed these to the StructuredGrid(X,Y,Z) function of pyvista to create a mesh for the plotter(StructuredGrid() of pyvista instantiate a vtkStructuredGrid then sets its point a vtkPoints object).
I came across vedo and was surprised to see that a bunch of features that I was looking for was already available there as opposed to Pyvista (this Is not a shot to pyvista at all, it is a great tool but in the long run vedo looks more suitable for my needs, so I'm thinking on migrating to it).
I do have a few questions though regarding a similar function StructuredGrid() of pyvista to create a 3D surface plot mesh with 3 matrices. I did look through a lot of the examples but it looks like the Volume() and Mesh() instances do not allow me to do it.
Any suggestion on that side ? (right now what am I doing is to create a vtkStructuredGrid() object with my X,Y,Z matrice)
The other question that I have is that I'd like to know if there is a way to set/update the Axe() object attribute on the fly since I will embedded the vedo plotter in a qt window? The only way that I seed is to create a callback function from the plotter and then overwrite the current Axe() actor on the plot with a new Axe() object with the attribute that I want.
Thank you a lot in advance for your help and sorry for the long message.
Beta Was this translation helpful? Give feedback.
All reactions