Module vrFileIO
[frames] | no frames]

Module vrFileIO

Functions
boolean
saveOSG(filename)
Writes scene as ascii opensg file (debugging only).
boolean
saveOSG(filename, options)
Writes scene as ascii opensg file (debugging only).
boolean
saveOSG(node, filename)
Writes scene as ascii opensg file (debugging only).
boolean
saveOSG(node, filename, options)
Writes scene as ascii opensg file (debugging only).
boolean
exportSceneSummary(node, filename, options)
Writes the scene summary as an xml file (debugging only).
boolean
exportSceneSummary(node, filename)
Writes the scene summary as an xml file (debugging only).
boolean
exportSceneSummary(filename, options)
Writes the scene summary as an xml file (debugging only).
boolean
exportSceneSummary(filename)
Writes the scene summary as an xml file (debugging only).
 
loadCloudProject(address)
Load project from blob storage, given by address.
 
loadCloudProject(address, token)
Load project from blob storage, given by address.
bool
exportSelectedSurface(filename, version)
Saves selected geometry file.
string
findFile(filename)
Find a filename relative to the fileio base directory.
bool
getApproximationEnabled()
Returns if body approximation is enabled in import.
bool
getDisableMultithreadedImport()
Returns if internal multithreading is disabled in CAD import.
string
getFileIOBaseDir()
Returns the base dir of the project.
string
getFileIOFilePath()
Returns the current loaded file path.
bool
getFixSurfaceOrientation()
Returns if surface normals should be unified in import.
bool
getHealStitchEnabled()
Returns if additional healing while stitch is enabled in import.
bool
getImportAssociativeMeshes()
Returns if import should contain associative mesh geometry.
bool
getImportBookmarks()
Returns if import should contain bookmarks.
bool
getImportCameras()
Returns if import should contain cameras.
bool
getImportCurves()
Returns if import should contain independent curves and poly-lines.
bool
getImportEmptyLayers()
Returns if import should contain empty layers.
bool
getImportInvisibleCurves()
Returns if import should contain invisible independent curves and poly-lines.
bool
getImportInvisibleInstances()
Returns if import of invisible instances is enabled.
bool
getImportInvisibleMeshes()
Returns if import should contain invisible mesh geometry.
bool
getImportInvisibleSurfaces()
Returns if import should contain invisible NURB surfaces.
bool
getImportLights()
Returns if import should contain lights.
bool
getImportMeshes()
Returns if import should contain mesh geometry.
bool
getImportParts()
Returns if import of part files is enabled.
bool
getImportSurfaces()
Returns if import should contain NURB surfaces.
bool
getImportTemplateGeometries()
Returns if import should contain template geometries.
int
getMaxParallelImportTasks()
Returns maximum parallelism of part file import when importing an assembly.
bool
getRobustTessellationEnabled()
Returns if more robust tessellation algorithm is enabled.
string
getVREDDataDir()
Returns the VRED data path.
string
getVREDDir()
Returns the VRED installation path.
string
getVREDExamplesDir()
Returns the VRED examples path.
string
getVServerScene()
Returns the current vserver scene path.
bool
isLoading()
Returns loading file state.
bool
load(filename, filenames, parent, newFile, showImportOptions)
Function signatures: load(fileName), load(fileNames), load(fileNames, parent, newFile, showImportOptions)
vrNodePtr
loadGeometry(filename)
Loads a geometry file.
list of vrNodePtr
loadOSB(filename)
Loads a single or multiple osb files from disk.
bool
save(filename)
Saves a geometry, script or project file.
bool
saveGeometry(root, filename)
Saves a geometry file.
bool
saveGeometryNoSwapCubeMaps()
Saves geometry without swapping the cube maps.
bool
saveSelectedGeometry(filename, includeEnvironmentGeometries)
Saves selected geometry file.
 
setApproximationEnabled(enable_approximation)
 
setConvertToUberMaterials(value)
Deprecated.
 
setDisableMultithreadedImport(disable_multithreading)
 
setFileIOKey(key)
Sets the current fileo key for crypted vpb files.
 
setFileIOMergeEnvironmentOption(option)
Sets the current vred project file merge behavior when adding a vpb file.
 
setFileIOMergeMaterials(merge)
Sets the current vred project file merge behavior when adding a vpb file.
 
setFileIOMergeProjectAnimations(import)
Sets the value for importing animations when loading VRED files.
 
setFileIOMergeProjectAnnotations(merge)
Sets the current vred project file merge behavior when adding a vpb file.
 
setFileIOMergeProjectClips(import)
Sets the value for importing animation clips when loading VRED files.
 
setFileIOMergeProjectSequences(merge)
Sets the current vred project file merge behavior when adding a vpb file.
 
setFileIOMergeProjectTouchSensors(merge)
Sets the current vred project file merge behavior when adding a vpb file.
 
setFileIOMergeProjectVariants(merge)
Sets the current vred project file merge behavior when adding a vpb file.
 
setFileIOValidationKey(vkey)
Sets the current fileo validation key for crypted vpb files.
 
setFixSurfaceOrientation(fix_surface_orientation)
 
setHealStitchEnabled(enable_heal_stitch)
 
setImportApplyMaterialsFromAssetManager(apply)
Sets the value for applying materials from asset manager when importing a file.
 
setImportAssociativeMeshes(enable_associative_meshes)
 
setImportBookmarks(enable_bookmarks)
 
setImportCameras(enable_cameras)
 
setImportCenterInOrigin(centerInOrigin)
Sets the value for centering loaded geometry in origin.
 
setImportCurves(enable_curves)
 
setImportEmptyLayers(enable_empty_layers)
 
setImportInvisibleCurves(enable_invisible_curves)
 
setImportInvisibleInstances(enable_invisible_instances)
Switch import of invisible instances.
 
setImportInvisibleMeshes(enable_invisible_meshes)
 
setImportInvisibleSurfaces(enable_invisible_surfaces)
 
setImportLights(enable_lights)
 
setImportMeshes(enable_meshes)
 
setImportParts(enable_parts)
Switch import of part files refereced in assemblies.
 
setImportPutOnGround(putOnGround)
Sets the value for putting loaded geometry on the zero plane.
 
setImportSurfaces(enable_surfaces)
 
setImportTemplateGeometries(enable_template_geometries)
 
setMaxParallelImportTasks(max_parallel_tasks)
 
setRobustTessellationEnabled(robust_tessellation)
 
setTessellationOptions(chord_deviation, normal_tolerance, max_chord_length, stitching, stitching_tolerance, mergegeometries, keep_nurbs, create_layer_groups, remove_groups, unshare_nodes, flush_transforms)
Sets the tessellation parameters to use when loading a file.
 
setVServerScene(scene)
Sets the current vserver scene path.
 
unloadGeometry(node, filename)
Unloads a geometry file.
 
vrFileClearTmpDir()
Deletes all files in the temporary directory.
string
vrFileGetTmpDir()
Returns a temporary filepath.
bool
vrFileRemoveTmpFile(filename)
Deletes a file in the temporary directory.
Function Details

saveOSG(filename)

 

Writes scene as ascii opensg file (debugging only).

Parameters:
  • filename (string) - filename
Returns: boolean
success

saveOSG(filename, options)

 

Writes scene as ascii opensg file (debugging only).

Parameters:
  • filename (string) - filename
  • options (string) - options
Returns: boolean
success

saveOSG(node, filename)

 

Writes scene as ascii opensg file (debugging only).

Parameters:
  • node (NodePtr) - scene graph node
  • filename (string) - filename
Returns: boolean
success

saveOSG(node, filename, options)

 

Writes scene as ascii opensg file (debugging only).

Parameters:
  • node (NodePtr) - scene graph node
  • filename (string) - filename
  • options (string) - options
Returns: boolean
success

exportSceneSummary(node, filename, options)

 

Writes the scene summary as an xml file (debugging only).

Parameters:
  • node (NodePtr) - scene graph node
  • filename (string) - filename
  • options (string) - a comma separated list e.g. "nodes=false,transforms=false,shells=false"
Returns: boolean
success

exportSceneSummary(node, filename)

 

Writes the scene summary as an xml file (debugging only).

Parameters:
  • node (NodePtr) - scene graph node
  • filename (string) - filename
Returns: boolean
success

exportSceneSummary(filename, options)

 

Writes the scene summary as an xml file (debugging only).

Parameters:
  • filename (string) - filename
  • options (string) - a comma separated list e.g. "nodes=false,transforms=false,shells=false"
Returns: boolean
success

exportSceneSummary(filename)

 

Writes the scene summary as an xml file (debugging only).

Parameters:
  • filename (string) - filename
Returns: boolean
success

loadCloudProject(address)

 

Load project from blob storage, given by address.

Parameters:
  • address (string) - URL for the file (no path).

loadCloudProject(address, token)

 

Load project from blob storage, given by address.

Parameters:
  • address (string) - URL for the file (no path).
  • token (string) - token used for authentication.

exportSelectedSurface(filename, version)

 

Saves selected geometry file.

Parameters:
  • filename (string) - The name of the geometry file.
  • version (int) - The version of the IGES file (0: OpenCascade Import, 1: vCAD Import).
Returns: bool
Returns true on success, false otherwise.

findFile(filename)

 

Find a filename relative to the fileio base directory.

Parameters:
  • filename (string) - The relative filename.
Returns: string
The absolute file path.

getApproximationEnabled()

 

Returns if body approximation is enabled in import.

Returns: bool
true if body approximation is enabled, otherwise false.

getDisableMultithreadedImport()

 

Returns if internal multithreading is disabled in CAD import.

Returns: bool
true if multithreading is disabled, otherwise false.

getFileIOBaseDir()

 

Returns the base dir of the project.

Returns: string
The directory name.

getFileIOFilePath()

 

Returns the current loaded file path.

Returns: string
The file path.

getFixSurfaceOrientation()

 

Returns if surface normals should be unified in import.

Returns: bool
true if normal unification is enabled, otherwise false.

getHealStitchEnabled()

 

Returns if additional healing while stitch is enabled in import.

Returns: bool
true if heal stitch is enabled, otherwise false.

getImportAssociativeMeshes()

 

Returns if import should contain associative mesh geometry. (Catia V5, NX, STEP)

Returns: bool
true if import of mesh associative geometry is enabled, otherwise false.

getImportBookmarks()

 

Returns if import should contain bookmarks.

Returns: bool
true if import of bookmarks is enabled, otherwise false.

getImportCameras()

 

Returns if import should contain cameras.

Returns: bool
true if import of cameras is enabled, otherwise false.

getImportCurves()

 

Returns if import should contain independent curves and poly-lines.

Returns: bool
true if import of independent curves and poly-lines is enabled, otherwise false.

getImportEmptyLayers()

 

Returns if import should contain empty layers.

Returns: bool
true if import of empty layers is enabled, otherwise false.

getImportInvisibleCurves()

 

Returns if import should contain invisible independent curves and poly-lines.

Returns: bool
true if import of invisible independent curves and poly-lines is enabled, otherwise false.

getImportInvisibleInstances()

 

Returns if import of invisible instances is enabled. Usually used to filter geometries not needed in VRED and improve import performance.

Returns: bool
true if import of invisible instances is enabled, otherwise false.

getImportInvisibleMeshes()

 

Returns if import should contain invisible mesh geometry.

Returns: bool
true if import of invisible mesh geometry is enabled, otherwise false.

getImportInvisibleSurfaces()

 

Returns if import should contain invisible NURB surfaces.

Returns: bool
true if import of invisible NURB surfaces is enabled, otherwise false.

getImportLights()

 

Returns if import should contain lights.

Returns: bool
true if import of lights is enabled, otherwise false.

getImportMeshes()

 

Returns if import should contain mesh geometry.

Returns: bool
true if import of mesh geometry is enabled, otherwise false.

getImportParts()

 

Returns if import of part files is enabled.

Returns: bool
true if import of part files is enabled, otherwise false.

getImportSurfaces()

 

Returns if import should contain NURB surfaces.

Returns: bool
true if import of NURB surfaces is enabled, otherwise false.

getImportTemplateGeometries()

 

Returns if import should contain template geometries.

Returns: bool
true if import of template geometries is enabled, otherwise false.

getMaxParallelImportTasks()

 

Returns maximum parallelism of part file import when importing an assembly.

Returns: int
maximum number of parallel import tasks when importing part files from assembly.

getRobustTessellationEnabled()

 

Returns if more robust tessellation algorithm is enabled.

Returns: bool
true if more robust tessellation algorithm is enabled, otherwise false.

getVREDDataDir()

 

Returns the VRED data path.

Returns: string
path.

getVREDDir()

 

Returns the VRED installation path.

Returns: string
path.

getVREDExamplesDir()

 

Returns the VRED examples path.

Returns: string
path.

getVServerScene()

 

Returns the current vserver scene path.

Returns: string
file path.

isLoading()

 

Returns loading file state.

Returns: bool
loading file state.

load(filename, filenames, parent, newFile, showImportOptions)

 

Function signatures: load(fileName), load(fileNames), load(fileNames, parent, newFile, showImportOptions)

Loads a single or multiple files with wildcard support from disk. The loaded node is automatically attached to the root of the scenegraph.

The function can be called with a single filename or a list of filenames.

Supported file formats are the same as for (File -> Open) in the UI.

When loading from import file formats, no import dialog is shown. The loaded geometry is tessellated with the tessellation settings that are set in preferences or that have been last used for import. Tessellation settings can also be setup with setTessellationOptions.

Data from VRED file formats (project files .vpb and .osb) is validated and updated to the current VRED version if the file contains data from old VRED versions. Also, it is ensured that only one set of default cameras is in the scene.

VRED modules (e.g. Material Editor) are notified about the loaded data.

Parameters:
  • filename (string) - A single filename.
  • filenames (list of strings) - A list of filenames.
  • parent (vrNodePtr) - Scenegraph parent node.
  • newFile (bool) - False means add and true means calls new scene and load the files.
  • showImportOptions (bool) - Show import dialog options.
Returns: bool
Returns true on success, false otherwise.

loadGeometry(filename)

 

Loads a geometry file. The geometry is not attached to the scenegraph (and because of this not rendered), instead the user is responsible to attach it to the correct location in the scenegraph (see addChild method in vrNodePtr class).

Parameters:
  • filename (string) - The name of the geometry file.
Returns: vrNodePtr
Returns the root node of the geometry on success, NullFC otherwise.

loadOSB(filename)

 

Loads a single or multiple osb files from disk. The loaded node is automatically attached to the root of the scenegraph.

Nodes are loaded from file exactly like they have been saved, without any validation of the loaded data.

Data from older VRED versions is not converted.

Modules (except Scenegraph) are not informed about the loaded content.

To load data from osb with validation use load.

Parameters:
  • filename (list of strings) - A list of filenames.
Returns: list of vrNodePtr
Returns a list of root nodes added by this command.

save(filename)

 

Saves a geometry, script or project file.

Parameters:
  • filename (string) - The name of the file.
Returns: bool
Returns true on success, false otherwise.

saveGeometry(root, filename)

 

Saves a geometry file.

Parameters:
  • root (vrNodePtr) - The root node.
  • filename (string) - The name of the geometry file.
Returns: bool
Returns true on success, false otherwise.

saveGeometryNoSwapCubeMaps()

 

Saves geometry without swapping the cube maps.

Returns: bool
Returns true on success, false otherwise.

saveSelectedGeometry(filename, includeEnvironmentGeometries)

 

Saves selected geometry file.

Parameters:
  • filename (string) - The name of the geometry file.
  • includeEnvironmentGeometries (bool) - Defines if environment geometry switch should be included in the saved file (Optional).
Returns: bool
Returns true on success, false otherwise.

setApproximationEnabled(enable_approximation)

 
Parameters:
  • enable_approximation (bool) - Enables body approximation in import. Disabling body approximation might speed up import but can rarely create geometric glitches.

setConvertToUberMaterials(value)

 

Deprecated. Imported materials should always be converted to UberMaterials.

Parameters:
  • value (bool) - convert true/false.

setDisableMultithreadedImport(disable_multithreading)

 
Parameters:
  • disable_multithreading (bool) - Disables/enables internal multithreading in CAD import. Should only be disabled if import runs out of memory. Might degrade import performance

setFileIOKey(key)

 

Sets the current fileo key for crypted vpb files.

Parameters:
  • key (string) - key string.

setFileIOMergeEnvironmentOption(option)

 

Sets the current vred project file merge behavior when adding a vpb file.

Parameters:
  • option (int) - 0 = Use from scene, 1 = Use from file, 2 = Add from file, 3 = Merge.

setFileIOMergeMaterials(merge)

 

Sets the current vred project file merge behavior when adding a vpb file.

Parameters:
  • merge (boolean) - true for merging.

setFileIOMergeProjectAnimations(import)

 

Sets the value for importing animations when loading VRED files.

Parameters:
  • import (boolean) - true for import.

setFileIOMergeProjectAnnotations(merge)

 

Sets the current vred project file merge behavior when adding a vpb file.

Parameters:
  • merge (boolean) - true for merging.

setFileIOMergeProjectClips(import)

 

Sets the value for importing animation clips when loading VRED files.

Parameters:
  • import (boolean) - true for import.

setFileIOMergeProjectSequences(merge)

 

Sets the current vred project file merge behavior when adding a vpb file.

Parameters:
  • merge (boolean) - true for merging.

setFileIOMergeProjectTouchSensors(merge)

 

Sets the current vred project file merge behavior when adding a vpb file.

Parameters:
  • merge (boolean) - true for merging.

setFileIOMergeProjectVariants(merge)

 

Sets the current vred project file merge behavior when adding a vpb file.

Parameters:
  • merge (boolean) - true for merging.

setFileIOValidationKey(vkey)

 

Sets the current fileo validation key for crypted vpb files.

Parameters:
  • vkey (string) - validation key string.

setFixSurfaceOrientation(fix_surface_orientation)

 
Parameters:
  • fix_surface_orientation (bool) - Enables surface normal unification in import.

setHealStitchEnabled(enable_heal_stitch)

 
Parameters:
  • enable_heal_stitch (bool) - Enables additional healing while stitch in import. Disabling heal stitch might speed up import but can rarely create geometric glitches.

setImportApplyMaterialsFromAssetManager(apply)

 

Sets the value for applying materials from asset manager when importing a file.

Parameters:
  • apply (boolean) - true for apply.

setImportAssociativeMeshes(enable_associative_meshes)

 
Parameters:
  • enable_associative_meshes (bool) - Enables import of associative mesh geometry. (Catia V5, NX, STEP)

setImportBookmarks(enable_bookmarks)

 
Parameters:
  • enable_bookmarks (bool) - Enables import of bookmarks.

setImportCameras(enable_cameras)

 
Parameters:
  • enable_cameras (bool) - Enables import of cameras.

setImportCenterInOrigin(centerInOrigin)

 

Sets the value for centering loaded geometry in origin.

Parameters:
  • centerInOrigin (boolean) - true for center in origin.

setImportCurves(enable_curves)

 
Parameters:
  • enable_curves (bool) - Enables import of independent curve and polyline geometries.

setImportEmptyLayers(enable_empty_layers)

 
Parameters:
  • enable_empty_layers (bool) - Enables import of empty layers.

setImportInvisibleCurves(enable_invisible_curves)

 
Parameters:
  • enable_invisible_curves (bool) - Enables import of invisible indipendent curve and polyline geometries.

setImportInvisibleInstances(enable_invisible_instances)

 

Switch import of invisible instances. Usually used to filter geometries not needed in VRED and improve import performance.

Parameters:
  • enable_invisible_instances (bool) - Enables import of invisible instances.

setImportInvisibleMeshes(enable_invisible_meshes)

 
Parameters:
  • enable_invisible_meshes (bool) - Enables import of mesh geometry.

setImportInvisibleSurfaces(enable_invisible_surfaces)

 
Parameters:
  • enable_invisible_surfaces (bool) - Enables import of invisible NURB surfaces.

setImportLights(enable_lights)

 
Parameters:
  • enable_lights (bool) - Enables import of lights.

setImportMeshes(enable_meshes)

 
Parameters:
  • enable_meshes (bool) - Enables import of mesh geometry.

setImportParts(enable_parts)

 

Switch import of part files refereced in assemblies.

Parameters:
  • enable_parts (bool) - Enables import of part files.

setImportPutOnGround(putOnGround)

 

Sets the value for putting loaded geometry on the zero plane.

Parameters:
  • putOnGround (boolean) - true for put on ground.

setImportSurfaces(enable_surfaces)

 
Parameters:
  • enable_surfaces (bool) - Enables import of NURB surfaces.

setImportTemplateGeometries(enable_template_geometries)

 
Parameters:
  • enable_template_geometries (bool) - Enables import of template geometries.

setMaxParallelImportTasks(max_parallel_tasks)

 
Parameters:
  • max_parallel_tasks (int) - Set maximum number of parallel import tasks, used for parrallel reading part files from assembly.

setRobustTessellationEnabled(robust_tessellation)

 
Parameters:
  • robust_tessellation (bool) - Enables more robust tessellation algorithm. Might slow down import. Only needed if geometric glitches appear on tessellated bodies.

setTessellationOptions(chord_deviation, normal_tolerance, max_chord_length, stitching, stitching_tolerance, mergegeometries, keep_nurbs, create_layer_groups, remove_groups, unshare_nodes, flush_transforms)

 

Sets the tessellation parameters to use when loading a file.

Parameters:
  • chord_deviation (float) - The chord deviation. Lower values create a more accurate fit to the NURBS surface but also increase triangle count.
  • normal_tolerance (float) - The normal tolerance limits the allowed difference between the normals of a triangle edge. Lower values create smoother normals but increase the triangle count.
  • max_chord_length (float) - The maximum length of a triangle edge.
  • stitching (bool) - Enables stitching.
  • stitching_tolerance (float) - Sets the stitching tolerance. Only edges inside the tolerance can be stitched.
  • mergegeometries (bool) - Merges triangle geometries and creates shells if present.
  • keep_nurbs (bool) - Keeps the nurbs information to allow retessellation later on.
  • create_layer_groups (bool) - Creates groups for layers.
  • remove_groups (bool) - Removes any empty hierarchy branches.
  • unshare_nodes (bool) - If set to true, all clone connections are disrupted.
  • flush_transforms (bool) - If set to true, moves transform information to the geometry on lowest level.

setVServerScene(scene)

 

Sets the current vserver scene path.

Parameters:
  • scene (string) - The vserver scene path.

unloadGeometry(node, filename)

 

Unloads a geometry file.

Parameters:
  • node (NodePtr) - The node to unload.
  • filename (string) - The name of the geometry file.

vrFileGetTmpDir()

 

Returns a temporary filepath.

Returns: string
The filepath.

vrFileRemoveTmpFile(filename)

 

Deletes a file in the temporary directory.

Parameters:
  • filename (string) - The filename to remove.
Returns: bool
Returns true on success, false otherwise.