File Operations

xFileOpen

This method is used to open local files.

bool xFileOpen(String sFilePath)

return

Returns True, if successful.

sFilePath

Local file full path.

xFileMerge

This method is used to merge a local CAx file as a new model in the existing scene.

bool xFileMerge(String sFilePath)

return

Returns True, if successful.

sFilePath

Local file full path.

xFileSave

Saves scene as CAx file.

bool xFileSave(const String sFilePath)

return

Returns True, if successful.

sFilePath

Target CAx file full path.

xFileClose

This method clears opened files.

bool xFileClose (String sModel)

return

Returns True, if successful.

sModel

Reserved for future use. Can be ignored now by passing an empty string.

xMergeSettings

This method is used to preset the merging model’s location in the scene.

Note: This method has to be used before calling Error! Reference source not found. method.

bool xMergeSettings(short iMergeLocation, bool bApplyCurrentSettings, bool bShowModelLabels, float fTx, float fTy, float fTz, float fRx, float fRy, float fRz, float fRangle, float fSx, float fSy, float fSz)

return

Returns True, if successful.

iMergeLocation

It specifies the mode that sets the location of the merging model in the existing scene.

0 – As Is :             Places merging model in the world coordinates.
1 – Left :              Places the merging model on the left side of the existing scene.
2 – Right :             Places the merging model on the right side of the existing scene.
3 – Top :               Places the merging model on top of the existing scene.
4 – Bottom :            Places the merging model on the bottom of the existing scene.
5 – Custom-Relative :   Places the merging model relative transformations to the existing scene’s bounding center.
6 – Custom-Absolute :   Places the merging model in the given absolute transform position.

Note:

These fTx, fTy, fTz, fRx, fRy, fRz, fRangle, fSx, fSy, fSz will be valid only when iMergeLocation is 5 or 6. Otherwise, these values will be ignored.

bApplyCurrentSettings

If True, it will apply current CAE settings to the merging model.

bShowModelLabels

If True, displays label on each model to identify them.

fTx fTy fTz

Translation values on respective X, Y and Z-axis.

fRx fRy fRz fRangle

Rotation entries in quaternion form. The angle is in degrees.

fSx fSy fSz

Scale factor on respective X, Y and Z-axis.

xImportProfile

Imports profile file and applies.

bool xImportProfile(const String sFileName)

sFileName

VCollab Profile file path

xGenerateImage

This method takes a screenshot of the current view and saves it as an image file.

String xGenerateImage (String sImageFilePath)

return

Returns saved file path. If sImageFilePath is invalid it saves in default path and returns the value.

sImageFilePath

The local file path of image file to be saved. string, the image will be saved in default path and the path will be returned.

Note: Supported image file formats are jpg, png, bmp and tif.

xCaptureCAEAnimation

Saves applied CAE animation in a supported movie file.

bool xCaptureCAEAnimation(String sMovieFileName, int iSpeedFactor)

return

Returns True, if successful.

sMovieFileName

Target movie files full path with extension.

Supported file formats:

Video Formats : mp4, flv, avi, wmv, Animated GIF Files

Image Formats : jpg, bmp, tif, png

iSpeedFactor

It helps to define the speed factor for the movie file.

The allowed values are -4, -3, -2, -1, 0, 1, 2, 3 (Slow to Fast).

It creates the slowest movie if -4 is set and fastest movie if 3 is set.

xFileAddParts

Loads file as a sub-assembly.

String xFileAddParts(String sModel, String sParentAssembly, String sFilePath, bool bRefresh)

return

Returns name of root object(sub-assembly) of the loaded file.

sModel

For future use.

sParentAssemby

Sets parent. This assembly object in the existing scene will become the parent node to the loaded assembly object.

sFilePath

The full file path, that has to be loaded in the existing scene.

bRefresh

If True, it does full loading. If False, partial loading is done.

Note

  • If set as False, product explorer will not be updated.

  • When we are loading multiple files, it is recommended to set bRefresh as False to increase performance. Then call `xUpdateLoad <#xupdateload>`__ method to complete the loading.

xUpdateLoad

This method has to be called to complete the partial file loading of xFileAddParts.

void xUpdateLoad()

return

None.

xLaunchFileOpenGUI

Launches file open dialog.

bool xLaunchFileOpenGUI()

return

Returns True, if successful.

xLaunchFileMergeGUI

Launches file merge dialog.

bool xLaunchFileMergeGUI()

return

Returns True, if successful.

xLaunchFileSaveGUI

Launches file save dialog.

bool xLaunchFileSaveGUI()

return

Returns True, if successful.

xLaunchFileExportViewpointGUI

Launches export viewpoint dialog.

bool xLaunchFileExportViewpointGUI()

return

Returns True, if successful.

xUseFileNameAsModelName

Sets file name as model name.

void xUseFileNameAsModelName(bool bUseFileNameAsModelName)

return

None.

bUseFileNameAsModelName

If True, it sets file name as model name.

xIsFileNameAsModelNameUsed

Checks if filename as model name mode is used or not.

bool xIsFileNameAsModelNameUsed()

return

Returns True, if file name as model name mode is set.

xExportWCax

Exports viewpoint(s) into wCAX file.

bool xExportWCax(String sFilePath, int iViewPoint, bool bThumbNail,bool bPassword, String sPassword, bool bStoreNormal=True, bool bCompact=False)

return

Returns True, if successfully exported into wCAX file.

Returns False, if failed.

sFilePath

Output file path for wCAX file.

iViewPoint

value 0 - All viewpoints of all viewpaths.
value 1 - All viewpoints of current viewpath.
value 2 - Current viewpoint.

bThumbNail

if True, a thumbnail will be generated and stored for each viewpoint.

bPassword

if True, the file will be exported with password protection.

sPassword

Password for wCAX file opening. This is applicable only if bPassword is True.

bStoreNormal

If True, normal data will be stored in the wcax. Default value is True.

bCompact

If True, the size of the generated wcax file may be smaller. Default value is False.

xExportHTML

Exports viewpoint(s) into wCAX file.

bool xExportHTML(String sFilePath, int iViewPoint, bool bThumbNail,bool bPassword, String sPassword, bool bStoreNormal=True, bool bCompact=False)

return

Returns True, if successfully exported into HTML file.

Returns False, if failed.

sFilePath

Output file path for HTML file.

iViewPoint

value 0 - All viewpoints of all viewpaths.
value 1 - All viewpoints of current viewpath.
value 2 - Current viewpoint.
value 3 - Current display.

bThumbNail

If True, a thumbnail will be generated and stored for each viewpoint.

bPassword

If True, the file will be exported with password protection.

sPassword

Password for wCAX file opening. This is applicable only if bPassword is True.

bStoreNormal

If True, normal data will be stored in the wcax. Default value is True.

bCompact

If True, the size of the generated wcax file may be smaller. Default value is False.

xExportMeasurementData

Exports 3D measurement data into a comma separated value file (csv).

bool xExportMeasurementData(String sFileName)

return

Returns True if measurement data exported successfully.

Returns False otherwise.

sFileName

Output file name.

xGetWCaxViewerOptions

Gets array of on/off flags in wcax export options. Supported option names are,

  • “ProductTree”

  • “Section”

  • “Explode”

  • “Probe”

  • “Edges”

List<int> xGetWCaxViewerOptions(List<String> ViewerOptionNames)

return

Returns an array of input query size (1 to 5). A non-zero value refers to True, otherwise False;

ViewerOptionNames

List of option names. i.e, [“ProductTree”,”Section”,”Explode”,”Probe”,”Edges”]. Order can be shuffled and can be correlated the flags accordingly.

xSetWCaxViewerOptions

Sets on/off flags in wcax export options. Supported option names are,

  • “ProductTree”

  • “Section”

  • “Explode”

  • “Probe”

  • “Edges”

bool xSetWCaxViewerOptions(List<String> ViewerOptionNames, List<int> VisibilityValues)

Return

Returns True if successfully sets, False otherwise.

ViewerOptionNames

List of option names. i.e, [“ProductTree”,”Section”,”Explode”,”Probe”,”Edges”]. Order can be shuffled and flags should be given accordingly.

VisibilityValues

Array of integers to specify the flags for the given “ViewerOptionNames”. (1 refers to ON and 0 refers to Off).

Eg:
filter_names = ["ProductTree","Section", "Explode","Probe","Edges"]
filter_values = [1,1,1,0,1]
_VCollabAPI.xSetWCaxViewerOptions(filter_names,filter_values); This example enables Product Tree , Cut Section Ecplode and Edges feature in VCollab Web View
but not Probing feature.
::

Note: “ProductTree”,”Section”,”Explode” and “Probe” export is available based on VCollabPro feature licenses

pxGetCaxHistory

Gets cax file information about when it was created and source software and its version used

List<String> pxGetCaxHistory(String sCaxFilePath)

return

returns array of strings with modelfile information.

Returns empty string if failed.

sCaxFilePath

Cax File name including path. If empty string passed, current model will be considered.

xSetRetainWCaxFlag

Helps to save or retain wcax file when viewpoints are exported as a html file using xExportHTML() method.

bool xSetRetainWCaxFlag(bool bRetain)

return

Returns True if succeeds.

bRetain

True - saves the wcax file along with html file.

False - does not save the wcax file.

Note:This method should be called before calling xExportHTML method.

xGetRetainWCaxFlag

Gets current state of retain WCax flag.

bool xGetRetainWCaxFlag()

return

Returns bRetain flag.