You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to be able to append my meshes/combine them before I save them as a .vtk. I have multiple tubes and after I generate them I would prefer to have them all in one vtk file rather than having them all separate.
I have looked into the class pyvista.MultiBlock and append but I have not been able to apply it.
I have the tube data in a dictionary and I would have to loop through in order to add them as arguments combine them.
Thank you.
The text was updated successfully, but these errors were encountered:
If you already have all of the meshes/tubes in a dictionary, then you should try using a MultiBlock dataset and its combine method to merge all of the meshes. Here's an example:
importpyvistaaspvmy_tubes= {
'tube a': pv.Cylinder(center=(1,1,1), direction=(1,0,0)),
'tube b': pv.Cylinder(center=(0,1,1), direction=(1,1,0)),
'tube c': pv.Cylinder(center=(1,1,0), direction=(0,0,1)),
}
blocks=pv.MultiBlock(my_tubes)
merged=blocks.combine()
merged# this is now a single unstructured grid containing all geometry
The last release of PyVista (version 0.21.4) also added a nifty new + operator for all mesh types that you could use, but I'd recommend the combine method since you already have a dictionary
I would like to be able to append my meshes/combine them before I save them as a .vtk. I have multiple tubes and after I generate them I would prefer to have them all in one vtk file rather than having them all separate.
I have looked into the class pyvista.MultiBlock and append but I have not been able to apply it.
I have the tube data in a dictionary and I would have to loop through in order to add them as arguments combine them.
Thank you.
The text was updated successfully, but these errors were encountered: