SoInput Class |
Used to read Open Inventor data files.
Namespace: OIV.Inventor
The SoInput type exposes the following members.
Name | Description | |
---|---|---|
AddDirectoryFirst | The OIV.Inventor.SoInput class maintains a global list of directories that is searched to find files when opening them. | |
AddDirectoryLast | The OIV.Inventor.SoInput class maintains a global list of directories that is searched to find files when opening them. | |
AddEnvDirectoriesFirst(String) | Calls AddEnvDirectoriesFirst(envVarName, DIRECTORIES_SEPARATOR). | |
AddEnvDirectoriesFirst(String, String) | The OIV.Inventor.SoInput class maintains a global list of directories that is searched to find files when opening them. | |
AddEnvDirectoriesLast(String) | Calls AddEnvDirectoriesLast(envVarName, DIRECTORIES_SEPARATOR). | |
AddEnvDirectoriesLast(String, String) | The OIV.Inventor.SoInput class maintains a global list of directories that is searched to find files when opening them. | |
ClearDirectories | Clears the list of directories (including the current directory). | |
CloseFile | Closes all files on stack opened with OIV.Inventor.SoInput.OpenFile(System.String, System.Boolean, System.Boolean) or OIV.Inventor.SoInput.PushFile(System.String). | |
Eof | ||
Equals | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) | |
FindAbsolutePath | Returns absolute path of given file by looking in OIV.Inventor.SoInput standard directories. | |
Get | ||
GetASCIIBuffer | ||
GetASCIIFile | ||
GetCurFileName | Returns full name (including directory path) of current file. | |
GetCurStringFileName | Returns full name (including directory path) of current file. | |
GetDirectories |
Returns the list of directories.
| |
GetHashCode |
Overrides GetHashCode().
(Inherited from SoNetBase.) | |
GetHeader | Returns the header of the file being read. | |
GetInputParameters | Return the current OIV.Inventor.SoInputParameters. | |
GetIVVersion | Returns the Open Inventor file version of the file being read (2.1). | |
GetNumBytesRead | Returns the number of bytes read. | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
GetVRMLVersion | ||
IsBinary | ||
IsFileVRML2 | ||
IsUtf8 | ||
IsValidBuffer | Returns true if the current buffer is valid. | |
IsValidFile | Returns true if the currently open file is a valid Open Inventor file. | |
IsZCompressed | ||
OpenFile(String) | Calls OpenFile(fileName, false, false). | |
OpenFile(String, Boolean) | Calls OpenFile(fileName, okIfNotFound, false). | |
OpenFile(String, Boolean, Boolean) | Opens named file. | |
PushFile | Opens named file. | |
Read(Boolean) | ||
Read(Double) | ||
Read(Int16) | ||
Read(Int32) | ||
Read(Int64) | ||
Read(SByte) | ||
Read(Single) | ||
Read(String) | Calls Read(n, false). | |
Read(UInt16) | ||
Read(UInt32) | ||
Read(UInt64) | ||
Read(SByte, Boolean) | ||
Read(String, Boolean) | ||
ReadBinaryArray | ||
ReadBitMask(String) | Calls ReadBitMask(n, false). | |
ReadBitMask(String, Boolean) | ||
ReadByte(Byte) | ||
ReadByte(SByte) | ||
RemoveDirectory | Removes named directory from the list. | |
SetBuffer |
Sets an in-memory buffer to read from, along with its size.
| |
SetFileVRML2 | ||
SetInputParameters | Specify parameters to modify/control actions during the read of a file. | |
SetVRMLVersion | ||
ToString | Returns a string that represents the current object. (Inherited from Object.) | |
UpdateReadPercent | Reports the percentage of bytes read from the file. |
This class is used by the OIV.Inventor.SoDB reading routines when reading Open Inventor (.iv) format data or various geometry data formats that can be converted into an Open Inventor scene graph. The input source can be the standard input stream (default), a file (see openFile) or a buffer in memory (see setBuffer). OIV.Inventor.SoInput can search for a file in a list of directories (see addDirectoryFirst etc). OIV.Inventor.SoInput can report progress during the input operation (see updateReadPercent).
OIV.Inventor.SoInput is typically used with OIV.Inventor.SoDB.Read(OIV.Inventor.SoInput, OIV.Inventor.Nodes.SoNode@) or OIV.Inventor.SoDB.ReadAll(OIV.Inventor.SoInput) to load data and create a scene graph. There is an example code fragment on the OIV.Inventor.SoDB page.
NOTE: Applications should always check the result of calling the OIV.Inventor.SoInput.OpenFile(System.String, System.Boolean, System.Boolean) method. If the call fails, the OIV.Inventor.SoInput object itself is still valid and remains in the default state. Calling OIV.Inventor.SoDB.ReadAll(OIV.Inventor.SoInput), or methods like OIV.Inventor.SoInput.GetHeader() and OIV.Inventor.SoInput.IsValidFile(), with a default OIV.Inventor.SoInput object will make the application appear to "hang" because it is waiting for data on standard input. To check if a file exists, get file properties, etc see OIV.Inventor.Helpers.SbFileHelper.
File formats
OIV.Inventor.SoInput supports ASCII (default) and binary Open Inventor formats. Since Open Inventor 8.1, both the ASCII and binary formats can be compressed using the gz format (e.g. using gzip). The file extension 'ivz' is recognized for compressed Open Inventor files, but is not mandatory. In fact the initial bytes of the file are checked when the file is opened to automatically determine if it is compressed or not. This feature uses the module IvDLZlib.
OIV.Inventor.SoInput also has built-in support for:
VRML97 format (.wrl)
X3D Classic VRML format (.x3dv) See VRML_LIMITATIONS for details.
Additional input readers are provided as plugins for:
DXF format (.dxf)
STL format (.stl)
These formats require redistributing the corresponding plugin library with the application.
DXF : fei_inventor_io_dxf (e.g. fei_inventor_io_dxf.dll on Windows).
STL : fei_inventor_io_stl (e.g. fei_inventor_io_stl.dll on Windows).
Open Inventor also supports many standard CAD file formats. See OIV.Inventor.IO.CAD.SoCADInputReader for the current list. These formats also require redistributing the corresponding plugin library (fei_inventor_io_cad) with the application.
OIV.Inventor.SoInput can also be extended with custom file format readers. Input readers are defined as new classes inheriting from the OIV.Inventor.SoInputReader class.. See OIV.Inventor.SoInputReader class for more information about defining and loading new readers
For Open Inventor format files, users can also register additional valid file headers. When reading, OIV.Inventor.SoInput skips over Open Inventor comments (from '#' to end of line) and can stack input files. When EOF is reached, the stack is popped.
Directory List
OIV.Inventor.SoInput maintains a list of directories (initially empty). Generally Open Inventor classes that need to open a named file will search for the file in each of these directories in order. This includes OIV.Inventor.SoInput (the OIV.Inventor.SoInput.OpenFile(System.String, System.Boolean, System.Boolean) method), OIV.Inventor.Nodes.SoTexture2, OIV.Inventor.Nodes.SoFragmentShader and other nodes that have a "filename" field.
Note: OIV.Inventor.SoInput is not currently used for loading volume data files in VolumeViz. OIV.LDM.Nodes.SoDataSet and its subclasses (OIV.VolumeViz.Nodes.SoVolumeData etc) do not search the list of directories maintained by OIV.Inventor.SoInput when attempting to open a file. However the directory list is searched to find volume shader files (OIV.VolumeViz.Nodes.SoVolumeShader, OIV.VolumeViz.Nodes.SoVolumeRenderingQuality, etc).
The OIV.Inventor.SoInput directory list is initialized from the environnment variable OIV_FILE_SEARCH_PATHS. This variable may be set to a semi-colon separated list of directory paths. The specified paths may use variables in $name format, e.g. "$OIVHOME", which will be replaced by the value returned by OIV.Inventor.SoPreferences for that name. Additional directories may be added to the directory list using the static methods addDirectoryLast etc.
Static utility method OIV.Inventor.SoInput.FindAbsolutePath(System.String, System.String@) returns the full path of a file if it can be found in one of the directories in the list.
DXF Input Limitations:
The supported DXF file format release is 14.
The limitations are:
CLASSES, OBJECTS and THUMBNAILIMAGE sections are ignored.
TABLES section: APPID, BLOCK_RECORD,DIMSTYLE, LTYPE, LAYER, STYLE, UCS, VIEW, VIEWPORT are ignored.
ENTITIES section: ARCALIGNEDTEXT, DIMENSION, IMAGE, REGION, WIPEOUT are ignored.
VRML Input Limitations:
Starting from OIV10, it is no more possible to create VRML nodes. However, import of .vrml file is till supported but node are automatically converted to OIV nodes. Not all nodes are supported when reading VRML files. Here is list of supported nodes and their corresponding OIV nodes. Some VRML nodes will be converter to more or less complexe scenegraph. In this case, VRML node may be converted to an OIV.Inventor.Nodes.SoSeparator or an OIV.Inventor.Nodes.SoGroup containing scene graph.
GeoVRML nodes:
SoVRMLGeoLOD -> OIV.Inventor.Geo.SoGeoLOD
SoVRMLGeoElevationGrid -> OIV.Inventor.Nodes.SoSeparator
SoVRMLGeoOrigin -> OIV.Inventor.Geo.SoGeoOrigin
SoVRMLGeoLocation -> OIV.Inventor.Nodes.SoSeparator
SoVRMLGeoCoordinate -> OIV.Inventor.Geo.SoGeoCoordinate
Special Group nodes:
SoVRMLInline -> OIV.Inventor.Nodes.SoSeparator
SoVRMLLOD -> OIV.Inventor.Nodes.SoLevelOfDetail
SoVRMLSwitch -> OIV.Inventor.Nodes.SoSwitch
Common nodes:
SoVRMLDirectionalLight -> OIV.Inventor.Nodes.SoDirectionalLight
SoVRMLPointLight -> OIV.Inventor.Nodes.SoPointLight
SoVRMLSpotLight -> OIV.Inventor.Nodes.SoSpotLight
SoVRMLWorldInfo -> OIV.Inventor.Nodes.SoInfo
Geometry nodes:
SoVRMLElevationGrid -> OIV.Inventor.Nodes.SoSeparator
SoVRMLExtrusion -> OIV.Inventor.Nodes.SoGroup
SoVRMLIndexedFaceSet -> OIV.Inventor.Nodes.SoGroup
SoVRMLIndexedLineSet -> OIV.Inventor.Nodes.SoGroup
SoVRMLPointSet -> OIV.Inventor.Nodes.SoGroup
SoVRMLBox -> OIV.Inventor.Nodes.SoCube
SoVRMLCone -> OIV.Inventor.Nodes.SoCone
SoVRMLCylinder -> OIV.Inventor.Nodes.SoCylinder
SoVRMLSphere -> OIV.Inventor.Nodes.SoSphere
SoVRMLText -> OIV.Inventor.Nodes.SoSeparator
SoVRMLShape -> OIV.Inventor.Nodes.SoSeparator
Geometry properties:
SoVRMLCoordinate -> OIV.Inventor.Nodes.SoCoordinate3
SoVRMLColor -> OIV.Inventor.Nodes.SoMaterial
SoVRMLTextureCoordinate -> OIV.Inventor.Nodes.SoTextureCoordinate2
SoVRMLNormal -> OIV.Inventor.Nodes.SoNormal
Geometry appearance:
SoVRMLMaterial -> OIV.Inventor.Nodes.SoMaterial
SoVRMLImageTexture -> OIV.Inventor.Nodes.SoTexture2
SoVRMLPixelTexture -> OIV.Inventor.Nodes.SoTexture2
SoVRMLTextureTransform -> OIV.Inventor.Nodes.SoTexture2Transform
SoVRMLFontStyle -> OIV.Inventor.Nodes.SoFontStyle
SoVRMLAppearance -> OIV.Inventor.Nodes.SoGroup
Group nodes:
SoVRMLTransform -> OIV.Inventor.Nodes.SoSeparator
SoVRMLAnchor -> OIV.Inventor.Nodes.SoSeparator
SoVRMLBillboard -> OIV.Inventor.Nodes.SoBillboard
SoVRMLCollision -> OIV.Inventor.Nodes.SoSeparator
SoVRMLParent -> OIV.Inventor.Nodes.SoGroup
SoVRMLGroup -> OIV.Inventor.Nodes.SoSeparator
SoVRMLStaticGroup -> OIV.Inventor.Nodes.SoSeparator
Special nodes:
SoVRMLPROTOInstance -> OIV.Inventor.Nodes.SoSeparator