Skip to content

STLExporter

Save a topology in file.

Target: Sofa.Component.IO.Mesh

namespace: sofa::component::stlexporter

parents:

  • BaseSimulationExporter

Data

Name Description Default value
name object name unnamed
printLog if true, emits extra messages at runtime. 0
tags list of the subsets the objet 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 Path or filename where to export the data. If missing the name of the component is used.
exportEveryNumberOfSteps export file only at specified number of steps (0=disable, default=0) 0
exportAtBegin export file before the simulation starts, once the simulation is initialized (default=false) 0
exportAtEnd export file when the simulation is over and cleanup is called, i.e. just before deleting the simulation (default=false) 0
enable Enable or disable the component. (default=true) 1
binaryformat if true, save in binary format, otherwise in ascii 1
position points coordinates
triangle triangles indices
quad quads indices
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 BaseObject
master nullptr for regular objects, or master object for which this object is one sub-objects BaseObject

Examples

STLExporter.scn

<?xml version='1.0'?>
<Node   name='Root' gravity='0 0 0' time='0' animate='0'   >
   <RequiredPlugin name="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [MeshOBJLoader,STLExporter] -->
   <RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
   <RequiredPlugin name="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->

   <DefaultAnimationLoop/>
   <MechanicalObject position='0 1 2 3 4 5 6 7 8 9'/>
   <MeshOBJLoader name="loader" filename='mesh/liver-smooth.obj'/>
   <OglModel src="@loader"/>

   <STLExporter name='exporter1' printLog='true' filename='outFile' exportAtBegin='true' position="@loader.position" triangle="@loader.triangles"/>
</Node>
def createScene(root_node):

   root = root_node.addChild('Root', gravity="0 0 0", time="0", animate="0")

   root.addObject('RequiredPlugin', name="Sofa.Component.IO.Mesh")
   root.addObject('RequiredPlugin', name="Sofa.Component.StateContainer")
   root.addObject('RequiredPlugin', name="Sofa.GL.Component.Rendering3D")
   root.addObject('DefaultAnimationLoop', )
   root.addObject('MechanicalObject', position="0 1 2 3 4 5 6 7 8 9")
   root.addObject('MeshOBJLoader', name="loader", filename="mesh/liver-smooth.obj")
   root.addObject('OglModel', src="@loader")
   root.addObject('STLExporter', name="exporter1", printLog="true", filename="outFile", exportAtBegin="true", position="@loader.position", triangle="@loader.triangles")