Home › Forum › SOFA › Using SOFA › [SOLVED] Converting the STL mesh to VTK mesh
Tagged: 64_bits, MacOS, Plugin_SoftRobots, SOFA_1706, Soft Robots
- This topic has 1 reply, 1 voice, and was last updated 5 years, 2 months ago by MA.
Viewing 2 posts - 1 through 2 (of 2 total)
-
AuthorPosts
-
8 October 2019 at 12:54 #14359MABlocked
Hello,
I am trying to convert the following stl file to VTK , file attached: https://gofile.io/?c=0VSgmD
Using the following code in Soft Robotics Plugin example:
port Sofa import os path = os.path.dirname(os.path.abspath(__file__))+'/mesh/' def createScene(rootNode): rootNode.createObject('VisualStyle', displayFlags='showForceFields showBehaviorModels') rootNode.createObject('RequiredPlugin', pluginName='CGALPlugin') rootNode.createObject('RequiredPlugin', pluginName='SofaExporter') rootNode.createObject('RequiredPlugin', pluginName='SoftRobots') rootNode.findData('gravity').value='-9810 0 0'; node = rootNode.createChild('node') node.createObject('MeshSTLLoader', name='loader', filename=path+'Rope.stl') node.createObject('MeshGenerationFromPolyhedron', name='gen',inputPoints='@mesh.position', inputTriangles='@mesh.triangles', drawTetras='1') node.createObject('Mesh', position='@gen.outputPoints', tetrahedra='@gen.outputTetras') node.createObject('VTKExporter', filename='bunny', edges='0', tetras='1', exportAtBegin='1') node.createObject('MeshGenerationFromPolyhedron', inputPoints='@mesh.position', inputTriangles='@mesh.triangles', drawTetras='1', facetSize='0.35', facetApproximation='0.1', cellRatio='2', cellSize='0.5' )
In the console,it seems there isnothing created
- MeshTopology: 1 created with alias "Mesh" [INFO] [SceneCheckerVisitor] Finished validating node "root". [INFO] [VTKExporter(VTKExporter)] VTKExporter: found topology Mesh [INFO] [VTKExporter(VTKExporter)] ### VTKExporter[VTKExporter] ### Nb points: 0 Nb edges: 0 Nb triangles: 0 Nb quads: 0 Nb tetras: 0 Nb hexas: 0 ### ### Total nb cells: 0 [INFO] [VTKExporter(VTKExporter)] Export VTK XML in file bunny0.vtu done. [WARNING] [RealGUI] Global Bounding Box seems very small; Your viewer settings (based on the bbox) are likely invalid, switching to default value of [-1,-1,-1,1,1,1].This is caused by using component which does not implement properly the updateBBox function.You can remove this warning by manually forcing a value in the parameter bbox="minX minY minZ maxX maxY maxZ" in your root node [INFO] [SceneCheckerVisitor] Validating node "root" with checks: [SceneCheckAPIChange, SceneCheckDuplicatedName, SceneCheckMissingRequiredPlugin] [INFO] [SceneCheckAPIChange] No 'APIVersion' component in scene. Using the default APIVersion level: 17.06 [WARNING] [SceneCheckDuplicatedName] - Found duplicated names ['RequiredPlugin', ] in node '' Nodes with similar names at the same level in your scene can crash certain operations, please rename them [INFO] [SceneCheckerVisitor] Finished validating node "root".
8 October 2019 at 16:10 #14360MABlockedI solved it,in the following page:https://project.inria.fr/softrobot/documentation/volumetric-mesh-generation-using-cgal-plugin/
In line 6 of the code
node.createObject(‘VTKExporter’, filename=‘bunny’, edges=‘0’, tetras=‘1’, exportAtBegin=‘1’)
It missing path+
node.createObject(‘VTKExporter’, filename=path+‘bunny’, edges=‘0’, tetras=‘1’, exportAtBegin=‘1’)
-
AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.