VCollab Scripting Interface
Python 3 is embedded into VCollab Pro (using C++) to provide a scripting interface to VCollab. VCollab API functions listed here can be called from python scripts. User needs to create a python script and run the script from VCollab Pro. The python scripts can be run in following two modes:
In Batch Mode: When python scripts are specified as a command argument, the script will be executed in batch mode. In this mode, user can use a python script to create a CAX file with viewpoints or to create customized reports as an image, PPT and other supported formats.
"C:\\Program Files\\VCollab\\VCollabPro64\\VCollabPro.exe" -b "C:\\Temp\\MyReport_A.py"
In GUI Mode: Python script can be specified as input for “Import viewpoints…” function in “viewpoints context menu” in GUI mode. In this mode, the user can run a python script as a customized functionality to VCollabPro.

Note that the python scripts are executed from VCollabPro. All VCollab functions are listed under python interface object _VCollabAPI. A typical python script will look like this.
#Sample VCollab Script to create a viewpoint with Stress result
import _VCollabAPI ; # import Python interface Object from VCollabPro
import sys, os, traceback; # import system modules
bDebugFlag = True ; # flag used to show pop-up messages while debugging
def MainProgram(): # Using a function helps in error handling
# Open CAX file
bRtnFlag = _VCollabAPI.xFileOpen(u"C:\\Program Files\\VCollab\\Samples\\CAX\\beam.cax");
#Check for error status, If there is an error display a pop-up message
if bRtnFlag == False:
_VCollabAPI.xMessageBox(_VCollabAPI.xGetLastError(),bDebugFlag);return;
_VCollabAPI.xMessageBox(u"Start: beam.cax File Loaded", bDebugFlag);
#
#Get Current Model Name
sCurModel = _VCollabAPI.xGetCurCAEModelName();
#
#Display Stress Result
sCurResult = u"Stress";
sCurInstance = u"L1M1";
sCurDerivedResult = u"Von Mises Stress";
bRtnFlag = _VCollabAPI.xSetCAEResult(sCurModel,sCurResult,sCurInstance,sCurDerivedResult);
if bRtnFlag == False:
_VCollabAPI.xMessageBox(_VCollabAPI.xGetLastError(),bDebugFlag); return;
#
# Create Viewpoint
sViewPathName = u"Path 1";
sViewPointName = u"VP1- Von Mises Stress"
bRtnFlag = _VCollabAPI.xAddViewPoint(sViewPointName, sViewPathName,-1);
if bRtnFlag == False:
_VCollabAPI.xMessageBox(_VCollabAPI.xGetLastError(),bDebugFlag);return;
#
#Save as CAX file (file path need to have write access)
bRtnFlag=_VCollabAPI.xFileSave(u"C:\\Temp\\beam-vp.cax");
if bRtnFlag == False:
_VCollabAPI.xMessageBox(_VCollabAPI.xGetLastError(),bDebugFlag);return;
#
_VCollabAPI.xMessageBox(u"END: beam-vp.cax File Saved", bDebugFlag);
return;
# ================== execute main program ===============
try:
MainProgram();
except :
sTB = traceback.format_exc();
_VCollabAPI.xMessageBox(u"Error Trace!!! "+sTB,True);
#
#===========================================================