Class SoWriteAction


  • public class SoWriteAction
    extends SoAction
    Writes a scene graph to a file. This class is used for writing scene graphs in Open Inventor (.iv) format. SoWriteAction traverses the scene graph and uses an instance of SoOutput to write each node. SoOutput methods can be called to specify what file or memory buffer to write to. SoOutput supports both ASCII (default) and binary formats and provides some convenience functions for opening and closing files. See SbFileHelper for more convenience functions. Since Open Inventor 8.1, SoOutput can write compressed data in the lossless Zlib (gzip) format. Both ASCII and binary format files may be compressed.

    STL
    Open Inventor can also export geometry to an STL (.stl) format file. See SoSTLWriteAction.

    EXAMPLE

    An instance of SoOutput is automatically created by SoWriteAction. This is typically the only instance needed. For example:

     SoWriteAction action = new SoWriteAction();
     SoOutput      output = action.getOutput();
     output.openFile( "output.iv" );
     output.setBinary( true );  // Optional: write binary format
     action.apply( root );
     output.closeFile();

    See Also:
    SoOutput, SoSTLWriteAction
    • Constructor Detail

      • SoWriteAction

        public SoWriteAction()
        Constructor.
      • SoWriteAction

        public SoWriteAction​(SoOutput out)
        Constructor that takes an SoOutput to use for output.
    • Method Detail

      • enableElement

        public static void enableElement​(java.lang.Class<? extends Inventor> t,
                                         int stkIndex)
      • getOutput

        public SoOutput getOutput()
        Returns reference to SoOutput instance in action.