Click or drag to resize
SoInput Class

Used to read Open Inventor data files.

Inheritance Hierarchy

Namespace: OIV.Inventor
Assembly: OIV.Inventor (in OIV.Inventor.dll) Version: 2024.1.2.0 (2024.1.2)
public class SoInput : SoNetBase

The SoInput type exposes the following members.

Public methodSoInput


Public methodStatic memberAddDirectoryFirst

The OIV.Inventor.SoInput class maintains a global list of directories that is searched to find files when opening them.

Public methodStatic memberAddDirectoryLast

The OIV.Inventor.SoInput class maintains a global list of directories that is searched to find files when opening them.

Public methodStatic memberAddEnvDirectoriesFirst(String)
Calls AddEnvDirectoriesFirst(envVarName, DIRECTORIES_SEPARATOR).
Public methodStatic memberAddEnvDirectoriesFirst(String, String)

The OIV.Inventor.SoInput class maintains a global list of directories that is searched to find files when opening them.

Public methodStatic memberAddEnvDirectoriesLast(String)
Calls AddEnvDirectoriesLast(envVarName, DIRECTORIES_SEPARATOR).
Public methodStatic memberAddEnvDirectoriesLast(String, String)

The OIV.Inventor.SoInput class maintains a global list of directories that is searched to find files when opening them.

Public methodStatic memberClearDirectories

Clears the list of directories (including the current directory).

Public methodCloseFile

Closes all files on stack opened with OIV.Inventor.SoInput.OpenFile(System.String, System.Boolean, System.Boolean) or OIV.Inventor.SoInput.PushFile(System.String).

Public methodEof
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodStatic memberFindAbsolutePath

Returns absolute path of given file by looking in OIV.Inventor.SoInput standard directories.

Public methodGet
Public methodGetASCIIBuffer
Public methodGetASCIIFile
Public methodGetCurFileName

Returns full name (including directory path) of current file.

Public methodGetCurStringFileName

Returns full name (including directory path) of current file.

Public methodStatic memberGetDirectories
Returns the list of directories.
Public methodGetHashCode
Overrides GetHashCode().
(Inherited from SoNetBase.)
Public methodGetHeader

Returns the header of the file being read.

Public methodGetInputParameters

Return the current OIV.Inventor.SoInputParameters.

Public methodGetIVVersion

Returns the Open Inventor file version of the file being read (2.1).

Public methodGetNumBytesRead

Returns the number of bytes read.

Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodGetVRMLVersion
Public methodIsBinary
Public methodIsFileVRML2
Public methodIsUtf8
Public methodIsValidBuffer

Returns true if the current buffer is valid.

Public methodIsValidFile

Returns true if the currently open file is a valid Open Inventor file.

Public methodIsZCompressed
Public methodOpenFile(String)
Calls OpenFile(fileName, false, false).
Public methodOpenFile(String, Boolean)
Calls OpenFile(fileName, okIfNotFound, false).
Public methodOpenFile(String, Boolean, Boolean)

Opens named file.

Public methodPushFile

Opens named file.

Public methodRead(Boolean)
Public methodRead(Double)
Public methodRead(Int16)
Public methodRead(Int32)
Public methodRead(Int64)
Public methodRead(SByte)
Public methodRead(Single)
Public methodRead(String)
Calls Read(n, false).
Public methodRead(UInt16)
Public methodRead(UInt32)
Public methodRead(UInt64)
Public methodRead(SByte, Boolean)
Public methodRead(String, Boolean)
Public methodReadBinaryArray
Public methodReadBitMask(String)
Calls ReadBitMask(n, false).
Public methodReadBitMask(String, Boolean)
Public methodReadByte(Byte)
Public methodReadByte(SByte)
Public methodStatic memberRemoveDirectory

Removes named directory from the list.

Public methodSetBuffer
Sets an in-memory buffer to read from, along with its size.
Public methodSetFileVRML2
Public methodSetInputParameters

Specify parameters to modify/control actions during the read of a file.

Public methodSetVRMLVersion
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodUpdateReadPercent

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.



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:

Special Group nodes:

Common nodes:

Geometry nodes:

Geometry properties:

Geometry appearance:

Group nodes:

Special nodes:

See Also