vrFileIOService¶
-
class
vrFileIOService
¶
(Inherits vrBaseService
)
Summary¶
- Functions:
- abortImport(importId)
- abortJobs(jobIds)
- checkCadType(file)
- enableNewFormat()
- exportNodes(file, nodes, synchronousConversion) → integer
- getBaseFileSuffix(file) → string
- getExportSettings(fileType) → vrdFileExportSettings
- getExportSettingsFromPreferences(fileType) → vrdFileExportSettings
- getFileName() → string
- getFileTypeByFileName(file) → vrCADFileTypes.FileType
- getImageReadFilter() → string
- getImageWriteFilter() → string
- getImportSettings(fileType) → vrdAtfSettings
- getImportSettingsFromPreferences(fileType) → vrdAtfSettings
- getMaxNumImportProcesses() → integer
- getMergeProjectAnnotations() → bool
- getProjectMergeSettings() → vrdProjectMergeSettings
- getReadFileTypesFilter(mode) → string
- getSceneImportSettings() → vrdSceneImportSettings
- getSceneImportSettingsFromPreferences() → vrdSceneImportSettings
- getStreamName() → string
- getVREDDataDir() → string
- getVREDDir() → string
- getVREDExamplesDir() → string
- getVREDFileTypesFilter() → string
- getWriteFileTypesFilter(filename, includeExportFormats) → string
- hasImportSettings(file) → bool
- hasImportSettings(fileType) → bool
- hasSmartReferences(file) → bool
- importAtfFile(file, parent) → vrdNode
- importFiles(files, parent, atfConversionOutputDir, loadConvertedAtfFiles, removeConvertedAtfFiles, loadBehavior) → integer
- importMissingFiles(node, removeConvertedAtfFiles) → integer
- importPLMXMLFile(file, parent) → vrdNode
- inlineImageSequences()
- isAtfFile(file) → bool
- isConvertedAtfTree(root) → bool
- isReadOnly() → bool
- isSupportedFile(file) → bool
- isVredProject(file) → bool
- jobBelongsToImport(jobId, importId) → bool
- loadFile(file) → bool
- newFile()
- reimportNodes(nodes) → List[vrdNode]
- saveFile(file) → bool
- saveNodes(file, nodes, includeEnvironmentGeometries, filterBSides) → bool
- setExportSettings(fileType, settings)
- setImportSettings(fileType, settings)
- setKey(key)
- setMaxNumImportProcesses(value)
- setProjectMergeSettings(settings)
- setSceneImportSettings(settings)
- undoInlineImageSequences()
- validateAtfTree(file, root, parent)
- Signals:
- childFileImportAdded(jobId, parentFile, childFile)
- childFileImportFinished(jobId, parentFile, childFile)
- childrenFileConversionFinished(jobId, parentFile, durationInSeconds)
- conversionFinished(importId, durationInSeconds)
- conversionProgressChanged(importId, percent, status)
- exportedFile(filename)
- fileAddedToLoadQueue(jobId, file)
- fileAddedToScene(jobId, file, node)
- fileConversionAborted(jobId, file)
- fileConversionFailed(jobId, file, description)
- fileConversionFinished(jobId, file, state, durationInSeconds)
- fileConversionProgressChanged(jobId, file, percent, status)
- fileConversionStarted(jobId, file)
- fileConversionSucceded(jobId, file)
- fileLoadingFailed(jobId, file, description)
- fileLoadingFinished(jobId, file, state)
- fileLoadingProgressChanged(jobId, file, percent, status)
- fileLoadingStarted(jobId, file)
- fileTypeReceived(file, fileType)
- importFinished(importId, durationInSeconds)
- importProgressChanged(importId, percent)
- loadedGeometry(filename, nodeid)
- newScene()
- preNewScene()
- preQuit()
- progress(p)
- project(loading)
- projectLoad(filename)
- projectLoaded(filename)
- projectLoadFinished(filename, success)
- projectMerged()
- projectReadyToRender()
- projectSave(filename)
- projectSaved(filename)
- savedGeometry(filename)
- startingConversion(importId, fileCount)
- startingImport(importId, fileCount)
Functions¶
-
vrFileIOService.
abortImport
(importId)¶ Aborts an import job.
Parameters: importId (integer) – The identifier for the import job
-
vrFileIOService.
abortJobs
(jobIds)¶ Aborts pending or running import or export jobs.
Parameters: jobIds (List[integer]) – The identifiers for the jobs
-
vrFileIOService.
checkCadType
(file)¶ Asynchronously starts querying the CAD file type of a file with the given file path. After succesfully querying the type or looking it up in a cache a fileTypeReceived signal is emitted. This might be needed since some file extensions, i.E. .prt, can’t be clearly associated with a single file type.
Parameters: file (string) – The filename of the CAD file
-
vrFileIOService.
enableNewFormat
()¶ Enables the new file format, which is faster and more secure.
-
vrFileIOService.
exportNodes
(file, nodes, synchronousConversion=False)¶ Export nodes to a file, see also vrFileIOService.exportedFile(filename)
Parameters: - file (string) – The file path
- nodes (List[vrdNode]) – The nodes to be exported
- synchronousConversion (bool) – If True, the function waits until the conversion is finished.
Returns: The identifier of the conversion job or ‘0’ if the export already finished.
Return type: integer
-
vrFileIOService.
getBaseFileSuffix
(file)¶ Returns the file extension.
Parameters: file (string) – The filename Returns: The file extension. Return type: string
-
vrFileIOService.
getExportSettings
(fileType)¶ Gets the current export settings for a given CAD file type.
Parameters: fileType (vrCADFileTypes.FileType) – The file type for which the export settings should be returned. Returns: The export settings. Return type: vrdFileExportSettings
-
vrFileIOService.
getExportSettingsFromPreferences
(fileType)¶ Gets the export settings from preferences.
Parameters: fileType (vrCADFileTypes.FileType) – The file type for which the export settings should be returned. Returns: The export settings from preferences. Return type: vrdFileExportSettings
-
vrFileIOService.
getFileName
()¶ Gets the current file name.
Returns: The file name. Return type: string
-
vrFileIOService.
getFileTypeByFileName
(file)¶ Gets the file type by file name.
Parameters: file (string) – The filename Returns: The file type for file name. Return type: vrCADFileTypes.FileType
-
vrFileIOService.
getImageReadFilter
()¶ This returns a space separated list of the supported image file types that can be loaded.
Returns: The supported image file types for loading Return type: string
-
vrFileIOService.
getImageWriteFilter
()¶ This returns a space separated list of the the supported image file types that can be saved.
Returns: The supported image file types for saving Return type: string
-
vrFileIOService.
getImportSettings
(fileType)¶ Gets the current import settings for a given CAD file type.
Parameters: fileType (vrCADFileTypes.FileType) – The file type for which the import settings should be returned. Returns: The import settings. Return type: vrdAtfSettings
-
vrFileIOService.
getImportSettingsFromPreferences
(fileType)¶ Gets the import settings from preferences.
Parameters: fileType (vrCADFileTypes.FileType) – The file type for which the import settings should be returned. Returns: The import settings from preferences. Return type: vrdAtfSettings
-
vrFileIOService.
getMaxNumImportProcesses
()¶ Returns the maximum number import processes.
Returns: The maximum number import processes. Return type: integer
-
vrFileIOService.
getMergeProjectAnnotations
()¶ Flag indicates if annotations contained in a project file should be merged after loading.
Returns: The merge annotations flag Return type: bool
-
vrFileIOService.
getProjectMergeSettings
()¶ Gets the project merge settings.
Returns: The current project merge settings. Return type: vrdProjectMergeSettings
-
vrFileIOService.
getReadFileTypesFilter
(mode)¶ Gets the filter for readable file types.
Parameters: mode (vrFileTypes.FileExtensionFilterMode) – Returns: The readable file types filter. Return type: string
-
vrFileIOService.
getSceneImportSettings
()¶ Gets the scene current scene import settings.
Returns: The scene import settings. Return type: vrdSceneImportSettings
-
vrFileIOService.
getSceneImportSettingsFromPreferences
()¶ Gets the scene import settings from preferences.
Returns: The scene import settings from preferences. Return type: vrdSceneImportSettings
-
vrFileIOService.
getStreamName
()¶ Gets the current stream name.
Returns: The stream name. Return type: string
-
vrFileIOService.
getVREDDataDir
()¶ Gets the VRED data dir. This is the ‘data’ subfolder of the base directory.
Returns: The VRED data dir. Return type: string
-
vrFileIOService.
getVREDDir
()¶ Gets the base application directory.
Returns: The base application directory. Return type: string
-
vrFileIOService.
getVREDExamplesDir
()¶ Gets the VRED examples dir. This is the ‘examples’ subfolder of the base directory.
Returns: The VRED examples dir. Return type: string
-
vrFileIOService.
getVREDFileTypesFilter
()¶ Gets the VRED file types filter.
Returns: The VRED file types filter. Return type: string
-
vrFileIOService.
getWriteFileTypesFilter
(filename='', includeExportFormats=True)¶ Gets the filter for writable file types.
Parameters: - filename (string) – An optional current file name with a file extension
- includeExportFormats (bool) – If true, add export types
Returns: The writable file types filter.
Return type: string
-
vrFileIOService.
hasImportSettings
(file)¶ Determines if there are import settings for a given file.
Parameters: file (string) – The filename Returns: True if there are import settings, False otherwise. Return type: bool
-
vrFileIOService.
hasImportSettings
(fileType)¶ Determines if there are import settings for a given file type.
Parameters: fileType (vrCADFileTypes.FileType) – The file type Returns: True if there are import settings, False otherwise. Return type: bool
-
vrFileIOService.
hasSmartReferences
(file)¶ Queries for a OSB or VPB file if it contains smart references.
Parameters: file (string) – The filename of the VPB or OSB file Returns: True if file contains smart references Return type: bool
-
vrFileIOService.
importAtfFile
(file, parent)¶ Imports a file with the ATF loader.
Parameters: - file (string) – The file name
- parent (vrdNode) – The parent scene node where the imported file will be attached
Returns: The converted scene node
Return type:
-
vrFileIOService.
importFiles
(files, parent, atfConversionOutputDir='', loadConvertedAtfFiles=True, removeConvertedAtfFiles=True, loadBehavior=True)¶ Imports a list of files.
Parameters: - files (List[string]) – The files to import
- parent (vrdNode) – The parent node in the scene tree where these files should be added.
- atfConversionOutputDir (string) – The ATF conversion output dir
- loadConvertedAtfFiles (bool) – True if converted ATF files should be loaded
- removeConvertedAtfFiles (bool) – True if converted ATF files should be deleted
- loadBehavior (bool) – If True and root node of imported VPB file is a reference, mark root node in scenegraph as reference.
Returns: The identifier of the import job
Return type: integer
-
vrFileIOService.
importMissingFiles
(node, removeConvertedAtfFiles=True)¶ Imports missing files from a scene node.
Parameters: - node (vrdNode) – The scene node with unloaded parts
- removeConvertedAtfFiles (bool) – Remove already converted ATF files
Returns: The import id of the new import job for the missing files
Return type: integer
-
vrFileIOService.
importPLMXMLFile
(file, parent)¶ Imports a PLMXML file and the files it references.
Parameters: - file (string) – The file name
- parent (vrdNode) – The parent scene node where the imported file will be attached
Returns: The converted scene node
Return type:
-
vrFileIOService.
inlineImageSequences
()¶ Inlines all image sequences.
-
vrFileIOService.
isAtfFile
(file)¶ Checks if the given file can be imported with ATF.
Parameters: file (string) – The filename to check Returns: True if the file can be imported, False otherwise. Return type: bool
-
vrFileIOService.
isConvertedAtfTree
(root)¶ Checks if a scene node is a converted ATF tree.
Parameters: root (vrdNode) – The root node of the tree Returns: True if converted ATF tree, False otherwise. Return type: bool
-
vrFileIOService.
isReadOnly
()¶ Returns: True if the current project is read only Return type: bool
-
vrFileIOService.
isSupportedFile
(file)¶ Checks if a given file can be imported.
Parameters: file (string) – The filename to check Returns: True if supported file, False otherwise. Return type: bool
-
vrFileIOService.
isVredProject
(file)¶ Checks if the given file is a VRED project.
Parameters: file (string) – The filename to check Returns: True if it’s a VRED project, False otherwise. Return type: bool
-
vrFileIOService.
jobBelongsToImport
(jobId, importId)¶ Checks if an import identifier belongs to a given job.
Parameters: - jobId (integer) – The job identifier
- importId (integer) – The import identifier
Returns: True if the import id belongs to the job, False otherwise
Return type: bool
-
vrFileIOService.
loadFile
(file)¶ Loads a file.
Parameters: file (string) – The file to load Returns: True if loading succeeded, false otherwise Return type: bool
-
vrFileIOService.
newFile
()¶ Destroy the current scene and create a new scene with an empty file name.
-
vrFileIOService.
reimportNodes
(nodes)¶ Reimports a list of nodes with referenced source files.
Parameters: nodes (List[vrdNode]) – The scene nodes to reimport Returns: List of imported nodes Return type: List[vrdNode]
-
vrFileIOService.
saveFile
(file)¶ Saves a file.
Parameters: file (string) – The file to save Returns: True if saving succeeded, false otherwise Return type: bool
-
vrFileIOService.
saveNodes
(file, nodes, includeEnvironmentGeometries, filterBSides=False)¶ Saves a number of nodes to a file.
Parameters: - file (string) – The file path
- nodes (List[vrdNode]) – The nodes to be saved
- includeEnvironmentGeometries (bool) – If True, add environment geometry
- filterBSides (bool) – If True, B-Sides will not be exported
Returns: True if saving succeeded, false otherwise
Return type: bool
-
vrFileIOService.
setExportSettings
(fileType, settings)¶ Sets the file export settings for a given file type.
Parameters: - fileType (vrCADFileTypes.FileType) – The file type
- settings (vrdFileExportSettings) – The settings instance.
-
vrFileIOService.
setImportSettings
(fileType, settings)¶ Sets the import settings for a given file type.
Parameters: - fileType (vrCADFileTypes.FileType) – The file type
- settings (vrdAtfSettings) – The settings instance.
-
vrFileIOService.
setKey
(key)¶ Sets the key for file encryption.
Parameters: key (string) – The key
-
vrFileIOService.
setMaxNumImportProcesses
(value)¶ Sets the maximum number of import processes.
Parameters: value (integer) – The number of import processes
-
vrFileIOService.
setProjectMergeSettings
(settings)¶ Sets the project merge settings.
Parameters: settings (vrdProjectMergeSettings) – The project merge settings instance.
-
vrFileIOService.
setSceneImportSettings
(settings)¶ Sets the scene import settings.
Parameters: settings (vrdSceneImportSettings) – The scene import settings instance.
-
vrFileIOService.
undoInlineImageSequences
()¶ Removes all inlined image sequences.
Signals¶
-
vrFileIOService.
childFileImportAdded
(jobId, parentFile, childFile)¶ Emitted when a child CAD file import was added.
Parameters: - jobId (integer) – The identifier for the import job
- parentFile (string) – The parent file name
- childFile (string) – The child file name
-
vrFileIOService.
childFileImportFinished
(jobId, parentFile, childFile)¶ Emitted when a child CAD file import has finished.
Parameters: - jobId (integer) – The identifier for the import job
- parentFile (string) – The parent file name
- childFile (string) – The child file name
-
vrFileIOService.
childrenFileConversionFinished
(jobId, parentFile, durationInSeconds)¶ Emitted when the conversion of all child CAD files has finished.
Parameters: - jobId (integer) – The identifier for the import job
- parentFile (string) – The parent file name
- durationInSeconds (float) – The import duration in seconds
-
vrFileIOService.
conversionFinished
(importId, durationInSeconds)¶ Emitted when a file conversion job has finished.
To get notifications for individual files, you can use the fileConversionFinished signal.
Parameters: - importId (integer) – The identifier for the import job
- durationInSeconds (float) – The conversion duration in seconds
-
vrFileIOService.
conversionProgressChanged
(importId, percent, status)¶ Emitted when the progress of the file conversion changes.
Parameters: - importId (integer) – The identifier for the current import
- percent (integer) – The conversion progress in percent
- status (string) – The conversion status (“Reading”, “Converting”, Processing”…)
-
vrFileIOService.
exportedFile
(filename)¶ Emitted after a file has been exported.
Parameters: filename (string) – The filename that was exported
-
vrFileIOService.
fileAddedToLoadQueue
(jobId, file)¶ Emitted when a new CAD file has been added to the load queue.
Parameters: - jobId (integer) – The identifier for the import job
- file (string) – The file name
-
vrFileIOService.
fileAddedToScene
(jobId, file, node)¶ Emitted when a CAD file has been added to the current scene.
Parameters: - jobId (integer) – The identifier for the import job
- file (string) – The file name
- node (vrdNode) – The scene node of the added file
-
vrFileIOService.
fileConversionAborted
(jobId, file)¶ Emitted when a CAD file conversion has been aborted.
Parameters: - jobId (integer) – The identifier for the import job
- file (string) – The file name
-
vrFileIOService.
fileConversionFailed
(jobId, file, description)¶ Emitted when a CAD file conversion has failed.
Parameters: - jobId (integer) – The identifier for the import job
- file (string) – The file name
- description (string) – Description of the error
-
vrFileIOService.
fileConversionFinished
(jobId, file, state, durationInSeconds)¶ Emitted when the conversion of a CAD file has finished.
Parameters: - jobId (integer) – The identifier for the import job
- file (string) – The file name
- state (vrCADFileTypes.JobState) – The status of the job
- durationInSeconds (float) – The loading duration in seconds
-
vrFileIOService.
fileConversionProgressChanged
(jobId, file, percent, status)¶ Emitted when the progress of a CAD file conversion has changed.
Parameters: - jobId (integer) – The identifier for the import job
- file (string) – The file name
- percent (integer) – The conversion progress in percent
- status (string) – status message
-
vrFileIOService.
fileConversionStarted
(jobId, file)¶ Emitted when the conversion of a CAD file has started.
Parameters: - jobId (integer) – The identifier for the import job
- file (string) – The file name
-
vrFileIOService.
fileConversionSucceded
(jobId, file)¶ Emitted when a CAD file conversion has succeded.
Parameters: - jobId (integer) – The identifier for the import job
- file (string) – The file name
-
vrFileIOService.
fileLoadingFailed
(jobId, file, description)¶ Emitted when loading of an imported CAD file has failed.
Parameters: - jobId (integer) – The identifier for the import job
- file (string) – The file name
- description (string) – Description of the error
-
vrFileIOService.
fileLoadingFinished
(jobId, file, state)¶ Emitted when loading of an imported CAD file has finished.
Parameters: - jobId (integer) – The identifier for the import job
- file (string) – The file name
- state (vrCADFileTypes.JobState) – The status of the job
-
vrFileIOService.
fileLoadingProgressChanged
(jobId, file, percent, status)¶ Emitted when the loading progress of an imported CAD file changes.
Parameters: - jobId (integer) – The identifier for the import job
- file (string) – The file name
- percent (integer) – The loading progress in percent
- status (string) – status message
-
vrFileIOService.
fileLoadingStarted
(jobId, file)¶ Emitted when loading of an imported CAD file starts.
Parameters: - jobId (integer) – The identifier for the import job
- file (string) – The file name
-
vrFileIOService.
fileTypeReceived
(file, fileType)¶ Emitted when a new CAD file type has been received.
Parameters: - file (string) – The file name
- fileType (vrCADFileTypes.FileType) – The file type
-
vrFileIOService.
importFinished
(importId, durationInSeconds)¶ Emitted when an import job has finished.
Parameters: - importId (integer) – The identifier for the current import
- durationInSeconds (float) – The import duration in seconds
-
vrFileIOService.
importProgressChanged
(importId, percent)¶ Emitted when the import progress is updated.
Parameters: - importId (integer) – The identifier for the current import
- percent (integer) – The import progress percent
-
vrFileIOService.
loadedGeometry
(filename, nodeid)¶ Emitted after a geometry has been loaded.
Parameters: - filename (string) – The filename of the geometry
- nodeid (integer) – The node id of the geometry
-
vrFileIOService.
newScene
()¶ Emitted after a new scene is created.
-
vrFileIOService.
preNewScene
()¶ Emitted before a new scene is created.
-
vrFileIOService.
preQuit
()¶ Emitted before VRED is closed.
-
vrFileIOService.
progress
(p)¶ Periodically emitted to provide a percentage value of how much of the file has been loaded.
Parameters: p (integer) – Loading progress in percent
-
vrFileIOService.
project
(loading)¶ Emitted after a project has been successfully loaded. This signal is sent if loading aborted with an error.
Parameters: loading (bool) – True, on success.
-
vrFileIOService.
projectLoad
(filename)¶ Emitted when project loading starts.
Parameters: filename (string) – The filename of the loaded project
-
vrFileIOService.
projectLoaded
(filename)¶ Emitted after a project has been successfully loaded. This signal is not sent if loading aborted with an error.
Parameters: filename (string) – The filename of the loaded project
-
vrFileIOService.
projectLoadFinished
(filename, success)¶ Emitted after a project has been loaded The signal will always be sent whether loading succeeded or not.
Parameters: - filename (string) – The filename of the loaded project
- success (bool) – Indicates if loading was successful or not
-
vrFileIOService.
projectMerged
()¶ Emitted after a project has been merged.
-
vrFileIOService.
projectReadyToRender
()¶ Emitted after a project has been loaded and it is ready to render.
-
vrFileIOService.
projectSave
(filename)¶ Signal is emitted when a project is about to be saved.
Parameters: filename (string) – The filename of the project
-
vrFileIOService.
projectSaved
(filename)¶ Signal is emitted when a project has finished saving.
Parameters: filename (string) – The filename of the project.
-
vrFileIOService.
savedGeometry
(filename)¶ Emitted after a geometry has been saved.
Parameters: filename (string) – The filename of the geometry
-
vrFileIOService.
startingConversion
(importId, fileCount)¶ Emitted when file conversion starts.
Parameters: - importId (integer) – The identifier for the current import
- fileCount (integer) – The file count
-
vrFileIOService.
startingImport
(importId, fileCount)¶ Emitted when a file import job is started.
Parameters: - importId (integer) – The identifier for the current import
- fileCount (integer) – The number of files to be imported