MeshVTKLoader
This component belongs to the category of the MeshLoaders.
The MeshVTKLoader loads a mesh from a file under the format *.vtk. Such a mesh file can be either surface or volumetric meshes. The *.vtk meshes can be generated using the Paraview software.
Usage
No pre-requisite in your scene to use a MeshLoader.
Mesh loader for the VTK/VTU file format.
Target: Sofa.Component.IO.Mesh
namespace: sofa::component::io::mesh
parents:
- MeshLoader
Data
| Name | Description | Default value |
|---|---|---|
| name | object name | unnamed |
| printLog | if true, emits extra messages at runtime. | 0 |
| tags | list of the subsets the object belongs to | |
| bbox | this object bounding box | |
| componentState | The state of the component among (Dirty, Valid, Undefined, Loading, Invalid). | Undefined |
| listening | if true, handle the events, otherwise ignore the events | 0 |
| filename | Filename of the object | |
| flipNormals | Flip Normals | 0 |
| triangulate | Divide all polygons into triangles | 0 |
| createSubelements | Divide all n-D elements into their (n-1)-D boundary elements (e.g. tetrahedra to triangles) | 0 |
| onlyAttachedPoints | Only keep points attached to elements of the mesh | 0 |
| translation | Translation of the DOFs | 0 0 0 |
| rotation | Rotation of the DOFs | 0 0 0 |
| scale3d | Scale of the DOFs in 3 dimensions | 1 1 1 |
| transformation | 4x4 Homogeneous matrix to transform the DOFs (when present replace any) | [1 0 0 0,0 1 0 0,0 0 1 0,0 0 0 1] |
| Vectors | ||
| position | Vertices of the mesh loaded | |
| polylines | Polylines of the mesh loaded | |
| edges | Edges of the mesh loaded | |
| triangles | Triangles of the mesh loaded | |
| quads | Quads of the mesh loaded | |
| polygons | Polygons of the mesh loaded | |
| highOrderEdgePositions | High order edge points of the mesh loaded | |
| highOrderTrianglePositions | High order triangle points of the mesh loaded | |
| highOrderQuadPositions | High order quad points of the mesh loaded | |
| tetrahedra | Tetrahedra of the mesh loaded | |
| hexahedra | Hexahedra of the mesh loaded | |
| prisms | Prisms of the mesh loaded | |
| highOrderTetrahedronPositions | High order tetrahedron points of the mesh loaded | |
| highOrderHexahedronPositions | High order hexahedron points of the mesh loaded | |
| pyramids | Pyramids of the mesh loaded | |
| normals | Normals of the mesh loaded | |
| Groups | ||
| edgesGroups | Groups of Edges | |
| trianglesGroups | Groups of Triangles | |
| quadsGroups | Groups of Quads | |
| polygonsGroups | Groups of Polygons | |
| tetrahedraGroups | Groups of Tetrahedra | |
| hexahedraGroups | Groups of Hexahedra | |
| prismsGroups | Groups of Prisms | |
| pyramidsGroups | Groups of Pyramids | |
Links
| Name | Description | Destination type name |
|---|---|---|
| context | Graph Node containing this object (or BaseContext::getDefault() if no graph is used) | BaseContext |
| slaves | Sub-objects used internally by this object | BaseComponent |
| master | nullptr for regular objects, or master object for which this object is one sub-objects | BaseComponent |
Examples
MeshVTKLoader.scn
<!-- For more details see: https://wiki.sofa-framework.org/tdev/wiki/Notes/NewLoaderArchitecture -->
<Node name="Root" gravity="0 -9.81 0" dt="0.02">
<RequiredPlugin pluginName="Sofa.Component.SceneUtility"/> <!-- Needed to use components [AddDataRepository] -->
<RequiredPlugin pluginName="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [MeshVTKLoader] -->
<RequiredPlugin pluginName="Sofa.Component.Visual"/> <!-- Needed to use components [VisualStyle] -->
<RequiredPlugin pluginName="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->
<AddDataRepository path="../../../../share" />
<DefaultAnimationLoop/>
<VisualStyle displayFlags="showVisual showBehaviorModels showForceFields showCollision showMapping" />
<Node name="vtk file">
<MeshVTKLoader name="VtkLoader" filename="mesh/liver.vtk" flipNormals="0"/>
<OglModel name="VisualModel" src="@VtkLoader" color="red" texturename="textures/liver-texture-square.png" />
</Node>
<Node name="vtk polyline file" activated="true">
<MeshVTKLoader name="VtkLoader" filename="mesh/skull.vtp" scale3d="1000 1000 1000" translation="100 250 100" triangulate="1" />
<OglModel name="VisualModel" src="@VtkLoader" color="white" />
</Node>
</Node>
def createScene(root_node):
root = root_node.addChild('Root', gravity="0 -9.81 0", dt="0.02")
root.addObject('RequiredPlugin', pluginName="Sofa.Component.SceneUtility")
root.addObject('RequiredPlugin', pluginName="Sofa.Component.IO.Mesh")
root.addObject('RequiredPlugin', pluginName="Sofa.Component.Visual")
root.addObject('RequiredPlugin', pluginName="Sofa.GL.Component.Rendering3D")
root.addObject('AddDataRepository', path="../../../../share")
root.addObject('DefaultAnimationLoop', )
root.addObject('VisualStyle', displayFlags="showVisual showBehaviorModels showForceFields showCollision showMapping")
vtk_file = Root.addChild('vtk file')
vtk_file.addObject('MeshVTKLoader', name="VtkLoader", filename="mesh/liver.vtk", flipNormals="0")
vtk_file.addObject('OglModel', name="VisualModel", src="@VtkLoader", color="red", texturename="textures/liver-texture-square.png")
vtk_polyline_file = Root.addChild('vtk polyline file', activated="true")
vtk_polyline_file.addObject('MeshVTKLoader', name="VtkLoader", filename="mesh/skull.vtp", scale3d="1000 1000 1000", translation="100 250 100", triangulate="1")
vtk_polyline_file.addObject('OglModel', name="VisualModel", src="@VtkLoader", color="white")