SoToU3DAction Class |
Export a scene graph to a U3D file.
Namespace: OIV.HardCopy
The SoToU3DAction type exposes the following members.
Name | Description | |
---|---|---|
SoToU3DAction | Initializes a new instance of the SoToU3DAction class |
Name | Description | |
---|---|---|
AddLineSegmentCallback | Routine to add callbacks for generated primitives (line segments) for all shapes of the given type. | |
AddPointCallback | Routine to add callbacks for generated primitives (points) for all shapes of the given type. | |
AddPostCallback | Adds a callback function to call when a node of the given type is encountered during traversal. | |
AddPreCallback | Adds a callback function to call when a node of the given type is encountered during traversal. | |
AddTriangleCallback | Routine to add callbacks for generated primitives (triangles) for all shapes of the given type. | |
Apply(SoNode) | Initiates an action on the graph specified by a node. | |
Apply(SoPath) | Initiates an action on the graph specified by a path. | |
Apply(SoPathList) | Calls Apply(pathList, false). | |
Apply(SoPathList, Boolean) | Initiates an action on the graph specified by list of paths. | |
AreDraggersExported | Returns true if draggers are exported. | |
ClearApplyResult | When applied, an action may reference nodes or create objects (e.g. | |
CloseFile | Finalize export to the U3D output file. | |
EnableElement | ||
EnableElements | (Overrides SoCallbackActionEnableElements.) | |
Equals | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) | |
ForcePolygonalText3 | Forces OIV.Inventor.Nodes.SoText2 nodes to be exported using OIV.Inventor.Nodes.SoText3 (default is true). | |
ForwardTraversal(SoNode) | Traverse a node that is not part of the current scenegraph. | |
ForwardTraversal(SoPath) | Traverse a node that is not part of the current scenegraph. | |
GetComplexity | Returns complexity information from the state. | |
GetComplexityType | Returns complexity information from the state. | |
GetContinueActionInBranchFlag | This function indicates if the action must stop in the current branch. | |
GetCoordinate3 | Returns the current coordinates from the state. | |
GetCoordinate4 | Returns the current coordinates from the state. | |
GetCreaseAngle | Returns the current shape hints from the state. | |
GetCurPath | Returns the path accumulated during traversal, i.e., the chain of nodes from the root of the traversed graph to the current node being traversed. | |
GetCurrentResponse | (Inherited from SoCallbackAction.) | |
GetDecimationPercentage | Returns the current decimation percentage from the state. | |
GetDecimationType | Returns the current decimation type from the state. | |
GetDistribMode | Returns the distribution mode of this action across a cluster (ScaleViz-Cluster only). | |
GetDrawStyle | Returns the current drawing style information from the state. | |
GetFaceType | Returns the current shape hints from the state. | |
GetFocalDistance | Returns the current camera and viewing information from the state. | |
GetFontName | Returns the current font information from the state. | |
GetFontRenderStyle | Returns the current font information from the state. | |
GetFontSize | Returns the current font information from the state. | |
GetHashCode |
Overrides GetHashCode().
(Inherited from SoNetBase.) | |
GetLightAttenuation | Returns the current lighting model information from the state. | |
GetLightModel | Returns the current lighting model information from the state. | |
GetLinePattern | Returns the current drawing style information from the state. | |
GetLinePatternScaleFactor | Returns the current drawing style information from the state. | |
GetLineWidth | Returns the current drawing style information from the state. | |
GetMaterial(SbColor, SbColor, SbColor, SbColor, Single, Single) | Calls GetMaterial(ambient, diffuse, specular, emission, shininess, transparency, System.Int32(0)). (Inherited from SoCallbackAction.) | |
GetMaterial(SbColor, SbColor, SbColor, SbColor, Single, Single, Int32) | Returns the current material information from the state. | |
GetMaterialBinding | Returns the current material information from the state. | |
GetModelMatrix | Returns the current modeling transformation from the state. | |
GetNodeAppliedTo | Returns the node the action is being applied to. | |
GetNormal | Returns the current normal information from the state. | |
GetNormalBinding | Returns the current normal information from the state. | |
GetNumCoordinates | Returns the current coordinates from the state. | |
GetNumNormals | Returns the current normal information from the state. | |
GetNumProfileCoordinates | Returns the current profiles and their coordinates from the state. | |
GetNumTextureCoordinates | Returns texture information from the state. | |
GetOriginalPathListAppliedTo | Returns the original path list the action is being applied to. | |
GetPathAppliedTo | Returns the path the action is being applied to. | |
GetPathCode | Returns path code based on where current node (the node at the end of the current path) lies with respect to the path(s) the action is being applied to. | |
GetPathListAppliedTo | Returns the path list the action is being applied to. | |
GetPickStyle | Returns the current picking style. | |
GetPipeId | Gets pipe identifier in the range [1..N] associated to this render action while running a ScaleViz Multipipe configuration. | |
GetPointSize | Returns the current drawing style information from the state. | |
GetProfile | Returns the current profiles and their coordinates from the state. | |
GetProfileCoordinate2 | Returns the current profiles and their coordinates from the state. | |
GetProfileCoordinate3 | Returns the current profiles and their coordinates from the state. | |
GetProjectionMatrix | Returns the current camera and viewing information from the state. | |
GetSceneManager | Return the OIV.Inventor.SoSceneManager associated with this action. | |
GetShapeType | Returns the current shape hints from the state. | |
GetState | Gets the state from the action. | |
GetSwitch | Returns the current switch value. | |
GetTextureBlendColor | Returns texture information from the state. | |
GetTextureCoordinate2 | Returns texture information from the state. | |
GetTextureCoordinate4 | Returns texture information from the state. | |
GetTextureCoordinateBinding | Returns texture information from the state. | |
GetTextureFileName | Returns texture information from the state. | |
GetTextureImage(SbVec2i32, Int32) | Returns texture information from the state. | |
GetTextureImage(SbVec2s, Int32) | Obsolete. Returns texture information from the state. | |
GetTextureMatrix | Returns the current texture mapping information from the state. | |
GetTextureModel | Returns the current texture mapping information from the state. | |
GetTextureTransformNode | Returns the current texture mapping information from the state. | |
GetTextureWrapS | Returns the current texture mapping information from the state. | |
GetTextureWrapT | Returns the current texture mapping information from the state. | |
GetTransparencyType | Returns the current Transparency Type information from the state. | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
GetUnits | Returns the current units from the state. | |
GetVertexOrdering | Returns the current shape hints from the state. | |
GetViewingMatrix | Returns the current camera and viewing information from the state. | |
GetViewVolume | Returns the current camera and viewing information from the state. | |
GetWhatAppliedTo | Returns code indicating what action is being applied to. | |
HasTerminated | Returns true if the traversal has reached a termination condition. | |
InvalidateState | Invalidates the current traversal state in the action, forcing it to be recreated when the action is next applied. | |
InvokePostCallbacks | (Inherited from SoCallbackAction.) | |
InvokePreCallbacks | (Inherited from SoCallbackAction.) | |
IsBeingApplied | Returns true if this action is currently being applied. | |
IsCallbackAll | Returns whether the callback uses normal traversal (switches, etc.) or whether it traverses every single node. | |
IsLastPathListAppliedTo | Returns true if the current list is the last one from the original. | |
IsPolygonalText3Forced | Returns true if polygonal text3 is forced (see forcePolygonalText3). | |
IsUsingAlternateRep | Returns true if current action is using alternate representations. | |
OpenFile | Set the U3D output file. | |
PostDelayedTraversal | Method called by SoMultiPassManager after delayed pass traversals. | |
PreDelayedTraversal | Method called by SoMultiPassManager before delayed pass traversals. | |
ResetContinueActionInBranchFlag | This function resets the continue action flag. | |
SetCallbackAll | Sets whether the callback uses normal traversal (switches, etc.) or whether it traverses every single node. | |
SetExportDraggers | Allow the export of draggers (default is true). | |
SetPipeId | Sets pipe identifier in the range [1..N] associated to this render action while running a ScaleViz Multipipe configuration. | |
SetSceneManager | Set the scene manager associated with this action (if any ). | |
SetUpState | Creates state if it is NULL or it is no longer valid because new elements have been enabled since it was created. | |
ShouldGeneratePrimitives | (Inherited from SoCallbackAction.) | |
StopActionInBranch | This function stops the action in the current Scene Graph branch. | |
ToString | Returns a string that represents the current object. (Inherited from Object.) | |
Traverse | Does traversal of a graph rooted by a node. | |
UseAlternateRep | Tell the action to use alternate representations during traversal when available. |
Name | Description | |
---|---|---|
PostTailTraversal | (Inherited from SoCallbackAction.) | |
PreTailTraversal | (Inherited from SoCallbackAction.) |
This class can export an Open Inventor scenegraph to a U3D file. U3D files can be used to import a 3D scene into a PDF file. For a simple PDF export, see OIV.HardCopy.SoToPDFAction.
U3D is a much simpler format than the Open Inventor scene graph and limits what can be exported.
Limitations of U3D:
Cameras
Multiple cameras are ignored, only the main scenegraph is exported (no legends, logos...).
PoViews (OIV.Inventor.Gui.View.PoSceneView, OIV.Inventor.Gui.View.PoView, OIV.Inventor.Gui.View.PoBaseView) are not supported.
Lights
Lights affect the whole scenegraph no matter where they are placed in the scenegraph.
Per-vertex lighting is precomputed with default lights.
Two-sided lighting is not supported. Incorrect normals will result in black triangles. However note that the end user can enable two sided rendering in the Acrobat Reader preferences dialog under the "3D & Multimedia" tab.
Lines
Line width is not supported.
Per-vertex coloring and lighting are not supported on lines.
Precision issue on line vertices. Point locations may drasticaly diverge from orginal. Since this problem increases with the number of vertices per shape, try to split lines into smaller shapes.
MeshVizXLM
Enhanced coloring (MoMaterial) is not supported.
Fading threshold (MoDrawStyle) is not supported.
Polygon offset is not supported, so rendering cells with both faces and edges may result in depth buffering problems in the Adobe viewer.
Miscellaneous
FXViz representations are not supported.
Engines are ignored.
Dragger shapes are not exported.
Points
Coloring is not supported on points.
Rendering
Modeling clipping (OIV.Inventor.Nodes.SoClipPlane) is ignored.
Drawstyle is ignored.
Screen-aligned rendering (OIV.Inventor.Nodes.SoText2, OIV.Inventor.Nodes.SoBillboard, etc) is not supported.
Text
Text2 and textured Text3 are converted into polygonal Text3.
Textures
Only MODULATE and REPLACE texture models are supported.
Only REPEAT and CLAMP texture wraps are supported.
Multitexturing is not supported.
Transparency
Transparency is exported, but Adobe Reader's transparency algorithm is limited. Solid objects, MeshVizXLM mesh skin for example, can be handled correctly by Open Inventor's SORTED_PIXEL algorithm, but are not (in general) handled correctly by Adobe Reader (as of version 10.1 anyway).
VolumeViz
VolumeViz representations are not supported, except orthoslice, obliqueslice and volumeskin.
VolumeViz slices are exported with their current LOD (NB: LOD is minimal if the node has never been rendered).
LDM volumes with overlap of zero will not export correctly (gaps between tiles will be visible.
ROIs are ignored.
Lighting on VolumeViz slices is not supported.
VolumeViz slices are exported as simple RGBA textures (no colormap), which impacts visual quality (as if useRGBA field set)
Tips
Node names
Node names are exported for OIV.Inventor.Nodes.SoSeparator and OIV.Inventor.Nodes.SoShape, as well as all derived classes. These names will appear in the "Model Tree" in Acrobat Reader. The end user can set visibility, render mode, etc for each object. You can also use these names in JavaScript functions that manipulate the model in the PDF file.
Separator nodes with no assigned name will appear in the tree as "Group-XXX" and Shape nodes with no assigned name will appear in the tree as "Model-XXX", where "XXX" is the address of the node (just to make the name unique).
Names in the U3D file must be unique. Nodes with duplicate names will have a numeric value automatically appended to their name.
Lights: Lights in the scene graph will be exported. However note that the viewer's headlight will be exported as a directional light with a fixed position (it will not automatically rotate with the camera). If Acrobat Reader finds lights in the U3D file it will use those lights. So it may be better to export without lights and also to turn off the viewer's headlight before exporting to U3D. Note that one of the lighting options in Acrobat Reader is a headlight (that rotates with the camera).
Camera: If the action finds a camera in the scene graph, that camera will define the default view for the model in the PDF file. Therefore if you apply the action to a Separator above the viewer's camera, the exported model will be displayed with the current on-screen view.
Background color: You can export a background color using an OIV.Inventor.Nodes.SoGradientBackground node. The exported color will be the average of the color0 and color1 fields. However you can also change the background color using Adobe Acrobat Pro after inserting the U3D file in a PDF.
Two sided rendering: If the back faces of your geometry are black when displayed in Acrobat Reader, you may want to advise your users to enable the two sided rendering option in Reader's Preferences dialog under the "3D & Multimedia" tab.
Tools:
You can use the commercial tool Adobe Acrobat Pro to create and modify PDFs with embedded U3D content. Adobe calls this content "3D annotations".
You can also use open source tools like pdflatex, with the movie15 package, to create a PDF file with embedded 3D from a LaTeX source file.
Use case
SoSeparator root = new SoSeparator(); ... SoToU3DAction u3dAction = new SoToU3DAction(); bool result = u3dAction.OpenFile( "output.u3d" ); if ( !result ) { // Report error } u3dAction.Apply( root ); result = u3dAction.CloseFile(); if ( !result ) { // Report error }
Warning
On some platforms, some applications may encounter problems loading, displaying an error message like: "IFXOSFileIterator.ProcessDir: error opening /usr/local/u3d/lib/Plugins/ No such file or directory". In this case, declare the environment variable U3D_LIBDIR (UNIX only) and set it with the path to the Open Inventor libraries ($OIVHOME/lib).
It is now possible to specify a directory name which will contain the U3D plug-ins by setting the environment variable U3D_PLUGINS_DIRNAME for instance: "U3DPlugins". Important: This is not a path to the directory. Moreover this directory must remain in the same folder as fei_ifx_core.so/dll.
By default this action always uses the alternate representation of an OIV.Inventor.Nodes.SoNode derived class (if one exists).
The U3D_LIBDIR path is limited to 103 characters, path plus filename. If this length is exceeded, an error message is outputed and U3D library is not loaded.