Announcement

Collapse
No announcement yet.

VolumeMesh to STL

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • VolumeMesh to STL

    Hi Mike,

    Good day,
    I would like to ask for some of your advice in regards of how to save out the volume mesh in .stl file to be viewed as normal 3d object.

    I have gone through the VolumeMesh sample as well as tool such as ivToSTL and i have tried to save out the VolumeMesh scene in .iv and convert it to STL using the given tool; yet, the .stl file failed to open in normal stl viewer.

    Thus, i would like to have some guidelines on how to generate the model if possible. In addition, correct me if i am treading on the wrong path to get the task done.

    BTW, can i have some clarification on what VolVizScalarSet.cxx does to generate the volume mesh??

    Thanks a lot.

    -Vincent

  • #2
    Originally posted by vincentTan View Post
    I have gone through the VolumeMesh sample as well as tool such as ivToSTL and i have tried to save out the VolumeMesh scene in .iv and convert it to STL using the given tool; yet, the .stl file failed to open in normal stl viewer.

    BTW, can i have some clarification on what VolVizScalarSet.cxx does to generate the volume mesh??
    You didn't give us quite enough information to know what is going wrong. There may be some misunderstanding about how the different pieces of this puzzle are working together. I understand it's not necessarily clear from the documentation and examples. Here is some background info that may help.

    First, VolVizScalarSet does not generate the volume mesh. The actual mesh is defined by the MbVolumeMeshRegular object, which implements the MiVolumeMeshRegular interface. This is a very simple hexahedron mesh in which all cells are exactly the same size and are parallelpipeds (cuboids). It is the mesh equivalent of a volume data set, where each cell of the mesh corresponds to a voxel in the volume data set. This mesh is just a data object. There is no geometry associated with it, so it cannot itself be rendered or exported. Some representation node(s), e.g. MoMeshIsosurface, must be applied to create some geometry that can be rendered or exported.

    The VolVizScalarSet class, which implements MiScalardSetIjk, defines a scalar data set associated with the mesh. In other words it allows MeshViz to get the scalar value associated with each cell of the mesh. In this case it is a "programmatic" data set because, when queried for the value of a cell, it actually queries the VolumeViz data object (SoVolumeData node) to get the value of the corresponding voxel. This is also just a data object.

    Finally, the MoMeshIsosurface node extracts and renders a second mesh. In this case it extracts a surface mesh from the volume mesh, where the surface is defined by the specified iso-value. It also automatically generates (internally) some Open Inventor geometry to render the extracted surface mesh (the isosurface). It's this geometry that you (presumably) want to export as an STL file.

    It seems to work as expected.

    Attached is a slightly modified version of the VolMeshViz_01.cxx file from the example. In this version, pressing the 'E' key will export the isosurface geometry to an STL file. It's simply the addition of a viewer event callback to detect the key press and a few lines to create an instance of SoSTLWriteAction and apply the action to the MeshViz portion of the scene graph. In this case, since we're only exporting geometry, we don't care about cameras, lights, and other stuff that may be in the scene graph.

    Also attached is the STL file produced for this example's default iso-value. It is a valid STL file. However, as usual, it is not necessarily suitable for a specific use like 3D printing without applying a conditioning/repair tool.
    Attached Files

    Comment


    • #3
      Hi Mike,

      Sorry for not giving you enough information on what possibly is going wrong for me.

      However, i think you have understood my question and answered it perfectly. Thanks a lot for you answer and i shall go through the attached sample to get better grasp of it.

      -Vincent

      Comment

      Working...
      X