public class SoWriteAction extends SoAction
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.
X3D / VRML
Open Inventor ASCII format is essentially the same as the VRML97 format (because the standard was influenced by Open Inventor), which is now called the "Classic VRML" encoding in the X3D specification (see www.x3d.org). The main difference is the file header. If you need to write VRML compatible files, you must set the appropriate file header string using SoOutput's
setHeaderString method. However setting the correct header string does not guarantee everything in the file is valid X3D/VRML. If you need to convert a scene graph containing Open Inventor specific nodes to X3D/VRML, use SoToVRML2Action, then SoWriteAction.
STL
Open Inventor can also export geometry to an STL (.stl) format file. See SoSTLWriteAction.
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:
SoAction.AppliedCodes, SoAction.DistribModes, SoAction.PathCodes, SoAction.PathIndicesInventor.ConstructorCommandALL, BELOW_PATH, CLUSTER_ONLY, IN_PATH, LOCAL_ONLY, NO_PATH, NODE, OFF_PATH, PATH, PATH_LISTVERBOSE_LEVEL, ZeroHandle| Constructor and Description |
|---|
SoWriteAction()
Constructor.
|
SoWriteAction(SoOutput out)
Constructor that takes an
SoOutput to use for output. |
| Modifier and Type | Method and Description |
|---|---|
static void |
enableElement(java.lang.Class<? extends Inventor> t,
int stkIndex) |
SoOutput |
getOutput()
Returns reference to
SoOutput instance in action. |
void |
writeAllPROTO()
Write all defined VRMLPROTO to the current
SoOutput. |
void |
writeEXTERNPROTO(SoVRMLEXTERNPROTODef externprotoDef)
Write given
SoVRMLEXTERNPROTODef to the current SoOutput. |
void |
writePROTO(SoVRMLPROTODef protoDef)
Write given
SoVRMLPROTODef to the current SoOutput. |
apply, apply, clearApplyResult, forwardTraversal, getContinueActionInBranchFlag, getCurPath, getNodeAppliedTo, getOriginalPathListAppliedTo, getPathAppliedTo, getPathCode, getPathListAppliedTo, getPipeId, getSceneManager, getState, getWhatAppliedTo, hasTerminated, invalidateState, isBeingApplied, isLastPathListAppliedTo, isUsingAlternateRep, nullAction, postDelayedTraversal, preDelayedTraversal, resetContinueActionInBranchFlag, setPipeId, setSceneManager, setUpState, stopActionInBranch, traverse, useAlternateRepdispose, getAddress, getNativeResourceHandle, startInternalThreads, stopInternalThreadspublic void writeEXTERNPROTO(SoVRMLEXTERNPROTODef externprotoDef)
SoVRMLEXTERNPROTODef to the current SoOutput.public void writePROTO(SoVRMLPROTODef protoDef)
SoVRMLPROTODef to the current SoOutput.public void writeAllPROTO()
SoOutput.public static void enableElement(java.lang.Class<? extends Inventor> t, int stkIndex)
Generated on July 23, 2025, Copyright © Thermo Fisher Scientific. All rights reserved. http://www.openinventor.com