Interface ModelCenter::IModelCenter
Last update: 16.07.2025
Definition: ModelCenter/src/ModelCenter.odl (line 3947)
COM instance.
ModelCenter batch mode:
This example demonstrates invoking ModelCenter and running a Model in batch mode through the COM API.
Dim mc
Set mc=CreateObject("ModelCenter.Application")
mc.loadModel "c:\testmodel.pxc"
'
Dim x
Dim s
For x=0 To 10
mc.setValue "Model.Linear.x", x
s=s & "x=" & x & ", y=" & mc.getValue("Model.Linear.y") & vbNewLine
Next
msgbox s
Example ModelCenter Script:
This script demonstrates how to automate ModelCenter to create a Model.
First, a new Model is loaded into ModelCenter, two components are instantiated, and then several links are created.
Last, the Model is saved to a .pxc file.
' This is a test script that automates the creation of a Model
'
' -------------------- start ModelCenter
'
Dim app
Set app = WScript.CreateObject("ModelCenter.Application")
'
' -------------------- start a new Model
'
app.newModel
'
' -------------------- instantiate a few components
'
app.createComponent "mcre://localhost/Block", "block", "Model"
app.createComponent "mcre://localhost/Block", "block1", "Model"
'
' -------------------- create some links
'
app.createLink "Model.block.width", "Model.block1.width"
app.createLink "Model.block.height", "Model.block1.width + Model.block1.height"
'
' -------------------- save the file
'
file = "c:\model.pxc"
app.saveModelAs(file)
Example DOE Script:
This script demonstrates how to call ModelCenter to perform a DOE.
The script loads a Model into ModelCenter, and then repeatedly sets and gets values to perform the DOE.
'
' This is a test script that performs a DOE using ModelCenter. To
' run the script, type "cscript DOE.vbs"
'
'
' -------------------- start ModelCenter
'
Dim app
Set app = WScript.CreateObject( "ModelCenter.Application" )
'
' -------------------- load a file
'
file = "d:\model.pxc"
app.loadFile file
'
' -------------------- setup a DOE table
'
numTrials = 4
numInputs = 2
numOutputs = 2
Dim inputs(2)
inputs(0) = "script.VBScript.a"
inputs(1) = "script.VBScript.b"
Dim outputs(2)
outputs(0) = "script.VBScript.c"
outputs(1) = "script.VBScript.d"
Dim trials(4,2)
trials(0,0) = 5
trials(0,1) = 2
trials(1,0) = 4
trials(1,1) = 2
trials(2,0) = 5
trials(2,1) = 3
trials(3,0) = 4
trials(3,1) = 3
'
' -------------------- perform the runs
'
' print a header
msg = ""
For var = 0 To numInputs-1
msg = msg & inputs(var) & " "
Next
For var = 0 To numOutputs-1
msg = msg & outputs(var) & " "
Next
' print the values
WScript.echo msg
' collect and print values
For i = 0 To numTrials-1
' create a message
msg = ""
' set the input values
For var = 0 To numInputs-1
app.setValue inputs(var), trials(i,var)
msg = msg & trials(i,0) & " "
Next
' get the outputs
For var = 0 To numOutputs-1
msg = msg & app.getValue( outputs(var) ) & " "
Next
' print the values
WScript.echo msg
Next
Members
- addIcon
- addNewMacro
- appFullPath
- appName
- autoLink
- breakLink
- checkout
- checkout2
- closeHTMLViewer
- closeModel
- configureLogging
- createAndInitComponent
- createAssembly
- createAssemblyVariable
- createComponent
- createDataCollector
- createDataExplorer
- createDataHistoryVariable
- createDataMonitor
- createJobManager
- createLink
- createPlugInFrame
- createPlugInFrame2
- createTradeStudy
- destroyPlugInFrame
- displayAboutBox
- displayPreferencesDialog
- dumpComDebug
- exit
- getActiveJobManager
- getAssembly
- getAssemblyStyle
- getComponent
- getDataCollector
- getDataCollectorForDataExplorer
- getDataExplorer
- getDataMonitor
- getFileSystemInfo
- getFormatter
- getGlobalParameters
- getHaltStatus
- getHWND
- getLastErrorMessage
- getLicensingPath
- getLinks
- getLogger
- getMacroScript
- getMacroScriptLanguage
- getMacroTimeout
- getModel
- getModelCenterPath
- getModelUUID
- getNetworkLocations
- getNumUnitCategories
- getNumUnits
- getPreference
- getRunOnlyMode
- getUnitCategoryName
- getUnitName
- getValue
- getValueAbsolute
- getVariable
- getVariableMetaData
- getXMLExtension
- guiCloseAllMultiplexers
- guiLoadFile
- guiSaveModel
- halt
- hidePlugInFrame
- HTMLViewerGetMyHWND
- HTMLViewerWaitForClose
- internalLicensing
- invokeHelp
- IsInteractive
- isOkToClose
- launchDataCollectorPlugIn
- launchHTMLViewer
- launchMacroEditor
- launchTradeStudy
- loadFile
- loadModel
- MessageBox
- modelDirectory
- modelFileName
- moveComponent
- newModel
- parallelInstance
- ProcessID
- removeComponent
- removeDataMonitor
- run
- runAntFile
- runMacro
- SAFEARRAY
- saveModel
- saveModelAs
- saveTradeStudy
- saveVersionedModel
- saveVersionedModelAs
- screenUpdating
- setAlternateParentFrame
- setAssemblyStyle
- setIconPlugInFrame
- setLoginCallback
- setMacroScript
- setMacroScriptLanguage
- setMacroTimeout
- setPassword
- setPreference
- setRunOnlyMode
- setScheduler
- setUserName
- setValue
- setXMLExtension
- showFileBrowseDialog
- showFileSaveDialog
- showPlugInFrame
- startGUIMode
- tradeStudyEnd
- tradeStudyStart
- transformAVPoint
- unAssociatedInstance
- version
Properties
Property modelDirectory
Definition: ModelCenter/src/ModelCenter.odl (line 1)
BSTR ModelCenter::IModelCenter::modelDirectory
Directory of the current Model. If no model is open it will raise an error. If the model has not yet been saved, it will return an empty string.
Return type: BSTR
Property screenUpdating
Definition: ModelCenter/src/ModelCenter.odl (line 1)
boolean ModelCenter::IModelCenter::screenUpdating
Whether or not screen updating is turned on.
Return type: boolean
Property modelFileName
Definition: ModelCenter/src/ModelCenter.odl (line 1)
BSTR ModelCenter::IModelCenter::modelFileName
The Full path of the current ModelCenter Model.
Return type: BSTR
Property appName
Definition: ModelCenter/src/ModelCenter.odl (line 1)
BSTR ModelCenter::IModelCenter::appName
Gets the Application name
Returns:
Application name
Return type: BSTR
Property appFullPath
Definition: ModelCenter/src/ModelCenter.odl (line 1)
BSTR ModelCenter::IModelCenter::appFullPath
Gets the full path to the application.
Return type: BSTR
Property IsInteractive
Definition: ModelCenter/src/ModelCenter.odl (line 1)
BOOL ModelCenter::IModelCenter::IsInteractive
Is ModelCenter running in interactive/GUI mode.
Return type: BOOL
Property ProcessID
Definition: ModelCenter/src/ModelCenter.odl (line 1)
long ModelCenter::IModelCenter::ProcessID
The process identifier of the ModelCenter process. Useful for cases where ModelCenter is running in COM server mode and a client process needs to grant it permission to do something (like move a window to the foreground).
Return type: long
Property version
Definition: ModelCenter/src/ModelCenter.odl (line 4270)
long ModelCenter::IModelCenter::version
Gets the version number of ModelCenter. ModelCenter versions are in the form 5.1.2 where 5 is the major version, 1 is the minor, and 2 is the patch version.
Parameters:
-
index: Which part of the version to get.
-
0 - Get the major version number
-
1 - Get the minor version number
-
2 - Get the patch version number
Returns:
The requested version part.
Return type: long
Public functions
Function getLastErrorMessage
BSTR ModelCenter::IModelCenter::getLastErrorMessage()
Gets the last error message.
Returns:
The last error message.
Return type: BSTR
Function loadFile
void ModelCenter::IModelCenter::loadFile(BSTR fileName, [optional]VARIANT onConnectError)
Loads a .pxc file.
Parameters:
- fileName: Path of the .pxc file.
- onConnectError: States what to do when a connect error is encountered.
(see OnConnectionErrorMode for error modes, default is CONN_ERR_ERROR).
Parameters:
- BSTR fileName
- [optional] VARIANT onConnectError
Return type: void
Function setValue
void ModelCenter::IModelCenter::setValue(BSTR varName, BSTR value)
Sets the value of a variable.
Parameters:
- varName: Full ModelCenter path of the variable.
- value: The new value.
Parameters:
- BSTR varName
- BSTR value
Return type: void
Function getValue
VARIANT ModelCenter::IModelCenter::getValue(BSTR varName)
Gets the value of a variable.
Parameters:
- varName: Full ModelCenter path of the variable.
Returns:
The value as a variant.
Parameters:
- BSTR varName
Return type: VARIANT
Function createComponent
void ModelCenter::IModelCenter::createComponent(BSTR serverPath, BSTR name, BSTR parent, [optional]VARIANT xPos, [optional]VARIANT yPos)
Creates, or connects, to a new MCRE Component.
Parameters:
- serverPath: The MCRE source path of the new component.
- name: Name of the new component.
- parent: Parent assembly of the component.
- xPos: The x-position in pixels in the Analysis View.
- yPos: The y-position in pixels in the Analysis View.
Parameters:
- BSTR serverPath
- BSTR name
- BSTR parent
- [optional] VARIANT xPos
- [optional] VARIANT yPos
Return type: void
Function createLink
void ModelCenter::IModelCenter::createLink(BSTR variable, BSTR equation)
Creates a link to the specified variable based on the specified equation.
Parameters:
- variable: Variable to add the link to.
- equation: Equation of the link.
Parameters:
- BSTR variable
- BSTR equation
Return type: void
Function newModel
void ModelCenter::IModelCenter::newModel([optional]VARIANT modelType)
Creates a new Model.
Parameters:
- modelType:
Parameters:
- [optional] VARIANT modelType
Return type: void
Function saveModel
void ModelCenter::IModelCenter::saveModel()
Saves the current Model.
Return type: void
Function saveModelAs
void ModelCenter::IModelCenter::saveModelAs(BSTR fileName)
Saves the current Model to a specified file.
Parameters:
- fileName: Path to save the Model in.
Parameters:
- BSTR fileName
Return type: void
Function closeModel
void ModelCenter::IModelCenter::closeModel()
Closes the current Model.
Return type: void
Function loadModel
void ModelCenter::IModelCenter::loadModel(BSTR fileName, [optional]VARIANT onConnectError)
Loads a .pxc file.
Parameters:
- fileName: Path of the .pxc file.
- onConnectError: States what to do when a connect error is encountered.
(see OnConnectionErrorMode for error modes, default is CONN_ERR_ERROR).
Parameters:
- BSTR fileName
- [optional] VARIANT onConnectError
Return type: void
Function getVariable
IDispatch * ModelCenter::IModelCenter::getVariable(BSTR name)
Gets a pointer to a variable.
Parameters:
- name: Full ModelCenter path of the variable.
Returns:
IDispatch* to an IVariable object.
Parameters:
- BSTR name
Return type: IDispatch *
Function getComponent
IDispatch * ModelCenter::IModelCenter::getComponent(BSTR name)
Gets a pointer to the Component.
Parameters:
- name: Full ModelCenter path of the Component.
Returns:
IDispatch* to an IComponent object.
Parameters:
- BSTR name
Return type: IDispatch *
Function exit
void ModelCenter::IModelCenter::exit()
Deprecated. Deprecated:
No longer used.
Return type: void
Function createDataCollector
IDispatch * ModelCenter::IModelCenter::createDataCollector(BSTR tradeStudyType, BSTR setup)
Creates a new Data Collector.
Parameters:
- tradeStudyType: Registry ID of the Plug-In. This is obtained by calling the getRegID method of the IAddToModel* object that is passed into the Plug-In's construct method.
- setup: A string that is generated from the Plug-In's "toString" method that can be restored later by the Plug-In's "fromString" method.
Returns:
IDispatch* to an IDataCollector object.
Deprecated:
use createDataExplorer() instead
Parameters:
- BSTR tradeStudyType
- BSTR setup
Return type: IDispatch *
Function tradeStudyEnd
void ModelCenter::IModelCenter::tradeStudyEnd()
Lets ModelCenter know that a Trade Study has been completed.
Return type: void
Function createJobManager
IDispatch * ModelCenter::IModelCenter::createJobManager([optional]VARIANT showProgressDialog)
Creates a new Job Manager object.
Parameters:
-
showProgressDialog: an optional VARIANT that specifies whether or not to show a progress dialog when creating the job manager. Possible values are:
-
true to show a progress dialog and attempt to parent it to ModelCenter
-
false to not show a progress dialog
-
a long value that corresponds to the HWND of the window to which the progress dialog should be parented
Returns:
IDispatch* to an IJobManager object.
Parameters:
- [optional] VARIANT showProgressDialog
Return type: IDispatch *
Function tradeStudyStart
void ModelCenter::IModelCenter::tradeStudyStart()
Lets ModelCenter know that a Trade Study has been started.
Return type: void
Function getHaltStatus
boolean ModelCenter::IModelCenter::getHaltStatus()
Finds out if the user has pressed the halt button.
Returns:
yes(TRUE) or no(FALSE).
Return type: boolean
Function getModel
IDispatch * ModelCenter::IModelCenter::getModel()
Gets a pointer to the Model.
Returns:
IDispatch* to an IAssembly object.
Return type: IDispatch *
Function MessageBox
void ModelCenter::IModelCenter::MessageBox(BSTR msg,[optional]VARIANT force)
Creates a MessageBox dialog.
Parameters:
- msg: Message to display in the MessageBox.
- force:
Parameters:
- BSTR msg
- [optional] VARIANT force
Return type: void
Function getValueAbsolute
VARIANT ModelCenter::IModelCenter::getValueAbsolute(BSTR varName)
Gets the value of a variable without validating it.
Parameters:
- varName: Full ModelCenter path of the variable.
Returns:
The value as a variant.
Parameters:
- BSTR varName
Return type: VARIANT
Function setScheduler
void ModelCenter::IModelCenter::setScheduler(BSTR scheduler)
Sets the current active scheduler for the Model.
Parameters:
-
scheduler: The scheduler type. Possible types are:
-
forward
-
backward
-
mixed
-
script
Note: all scheduler types are case sensitive.
Parameters:
- BSTR scheduler
Return type: void
Function removeComponent
void ModelCenter::IModelCenter::removeComponent(BSTR name)
Removes the specified component from the Model.
Parameters:
- name: Full ModelCenter path of the component to remove.
Parameters:
- BSTR name
Return type: void
Function breakLink
void ModelCenter::IModelCenter::breakLink(BSTR variable)
Breaks the link to a variable.
Parameters:
- variable: The full ModelCenter path of the variable whose link is to be broken.
Example demonstrating how to break a link:
mc.breakLink "Model.Linear.x"
Parameters:
- BSTR variable
Return type: void
Function getHWND
long ModelCenter::IModelCenter::getHWND()
Gets the HWND of the current ModelCenter instance. This HWND can then be used as the parent of the Plug-In GUI.
Returns:
Value of the current HWND instance.
Return type: long
Function checkout
IDispatch * ModelCenter::IModelCenter::checkout(BSTR feature)
Checks out a license feature from FLEXlm
Parameters:
- feature: the name of the feature to be checked out
Returns:
an IFeature object
Parameters:
- BSTR feature
Return type: IDispatch *
Function checkout2
IDispatch * ModelCenter::IModelCenter::checkout2(BSTR feature, BSTR productRelease)
Checks out a license feature from FLEXlm
Parameters:
- feature: the name of the feature to be checked out
- productRelease: the release date of the feature being passed
Returns:
an IFeature object
Parameters:
- BSTR feature
- BSTR productRelease
Return type: IDispatch *
Function runMacro
VARIANT ModelCenter::IModelCenter::runMacro(BSTR macro, [optional]VARIANT useMCObject)
Runs the specified macro.
Parameters:
- macro: The name of the macro to run.
- useMCObject: whether or not to use the ModelCenter object
Returns:
Parameters:
- BSTR macro
- [optional] VARIANT useMCObject
Return type: VARIANT
Function createAssembly
IDispatch * ModelCenter::IModelCenter::createAssembly(BSTR name, BSTR parent, [optional]VARIANT assemblyType)
Creates a new Assembly in the Model.
Parameters:
- name: Desired name of the new Assembly.
- parent: Full ModelCenter path of the parent Assembly.
- assemblyType:
Returns:
IDispatch* to an IAssembly object.
Example demonstrating how to create an Assembly:
Dim assembly As IAssembly
Set assembly=mc.createAssembly("myAssembly", "Model")
Parameters:
- BSTR name
- BSTR parent
- [optional] VARIANT assemblyType
Return type: IDispatch *
Function createAssemblyVariable
IDispatch * ModelCenter::IModelCenter::createAssemblyVariable(BSTR name, BSTR type, BSTR parent)
Create a new variable in an Assembly.
Parameters:
-
name: Desired name of the new variable.
-
type: Type of the new variable. Possible types are:
-
double
-
int
-
boolean
-
string
-
file
-
double[]
-
int[]
-
boolean[]
-
string[]
-
quadfacet
-
surfaceofrevolution
-
nurbs
-
bspline
-
ruled
-
skinned
-
vrml
-
node
-
parent: Full ModelCenter path of the parent Assembly.
Returns:
IDispatch* to an IVariable object.
Example demonstrating how to create a variable in an existing Assembly:
Dim var As IVariable
Set var=mc.createAssemblyVariable("myVar", "double", "Model")
Parameters:
- BSTR name
- BSTR type
- BSTR parent
Return type: IDispatch *
Function autoLink
void ModelCenter::IModelCenter::autoLink(BSTR srcComp, BSTR destComp)
Automatically links two components.
Parameters:
- srcComp: The source component.
- destComp: The destination component.
Parameters:
- BSTR srcComp
- BSTR destComp
Return type: void
Function getLinks
LPDISPATCH ModelCenter::IModelCenter::getLinks([optional]VARIANT reserved)
Returns a list of all links in the model.
Parameters:
- reserved: Reserved for future use.
Returns:
IDispatch* to an IVariableLinks object.
Parameters:
- [optional] VARIANT reserved
Return type: LPDISPATCH
Function getModelUUID
BSTR ModelCenter::IModelCenter::getModelUUID()
Returns the unique ID string for the current model.
Returns:
The ID string for the current model.
Return type: BSTR
Function getFormatter
IDispatch * ModelCenter::IModelCenter::getFormatter(BSTR format)
Creates a new instance of a formatter which can be used to format numbers to and from a particular string style. See documentation on IPHXFormat.setFormat() for more information on available styles.
Parameters:
- format: Specified string format for the Formatter object.
Returns:
An IDispatch* to the IPHXFormat object.
Parameters:
- BSTR format
Return type: IDispatch *
Function invokeHelp
void ModelCenter::IModelCenter::invokeHelp(long pageID)
Invokes the specified context sensitive help item out of the ModelCenter help file.
Parameters:
- pageID:
Parameters:
- long pageID
Return type: void
Function launchTradeStudy
void ModelCenter::IModelCenter::launchTradeStudy(BSTR type, [optional]VARIANT setup)
Causes the specified Trade Study tool to be launched.
Parameters:
- type: May be a common name, like "doe" or a fully specified URL like "common:\tradestudy\doe".
- setup:
Parameters:
- BSTR type
- [optional] VARIANT setup
Return type: void
Function createPlugInFrame
long ModelCenter::IModelCenter::createPlugInFrame(BSTR name, BSTR title, BSTR reserved, LPDISPATCH plugIn, [optional]VARIANT showFavorites, [optional]VARIANT defaultHeight, [optional]VARIANT defaultWidth)
Creates a new frame window with favorites in it which can be used by Plug-Ins as a parent window in order to integrate with ModelCenter closer and to get favorites. Currently only supports C++ Plug-Ins.
Parameters:
- name: The programmatic name of the plug-in. This is used to store favorites and settings uniquely.
- title: The title to put on the frame
- reserved: Reserved, must be blank
- plugIn: An IDispatch to the plug-in, used to get at the to/from string to use with favorites.
- showFavorites:
- defaultHeight: The default height of the frame.
- defaultWidth: The default width of the frame.
Returns:
Parameters:
- BSTR name
- BSTR title
- BSTR reserved
- LPDISPATCH plugIn
- [optional] VARIANT showFavorites
- [optional] VARIANT defaultHeight
- [optional] VARIANT defaultWidth
Return type: long
Function displayAboutBox
void ModelCenter::IModelCenter::displayAboutBox()
Display the "About" dialog for ModelCenter.
Return type: void
Function halt
void ModelCenter::IModelCenter::halt()
Stop execution of the Model currently running in ModelCenter.
Return type: void
Function displayPreferencesDialog
void ModelCenter::IModelCenter::displayPreferencesDialog()
Display the "Preferences" dialog for ModelCenter.
Return type: void
Function run
void ModelCenter::IModelCenter::run(BSTR variableArray)
Runs a specified set of variables in the current Model.
Parameters:
- variableArray: A comma-separated list of ModelCenter variables to validate.
If no variables are specified then the entire model will be run (equivalent to clicking the scheduler run button).
Parameters:
- BSTR variableArray
Return type: void
Function getDataMonitor
IDispatch * ModelCenter::IModelCenter::getDataMonitor(BSTR component, VARIANT index)
Retrieves the indexed Data Monitor associated with the specified Component.
Parameters:
- component: The desired Component name.
- index: The desired index number (0-based index).
Returns:
Parameters:
- BSTR component
- VARIANT index
Return type: IDispatch *
Function createDataMonitor
IDispatch * ModelCenter::IModelCenter::createDataMonitor(BSTR component, BSTR name, int x, int y)
Creates a Data Monitor associated with a particular component.
Parameters:
- component: The name of the ModelCenter component to associate the Data Monitor with.
- name: The name of the Data Monitor.
- x: The x-position of the Data Monitor.
- y: The y-position of the Data Monitor.
Returns:
Parameters:
- BSTR component
- BSTR name
- int x
- int y
Return type: IDispatch *
Function isOkToClose
boolean ModelCenter::IModelCenter::isOkToClose()
Determines whether any sub-windows are currently open in ModelCenter.
Returns:
True if no sub windows are open, else false.
Return type: boolean
Function addIcon
short ModelCenter::IModelCenter::addIcon(BSTR iconFile)
Adds a given icon file to the list of icons known by model.
Parameters:
- iconFile: The name of the icon file to add.
Returns:
The index of the icon in ModelCenter's icon list.
Parameters:
- BSTR iconFile
Return type: short
Function removeDataMonitor
boolean ModelCenter::IModelCenter::removeDataMonitor(BSTR component, VARIANT index)
Remove a specific data monitor associated with a particular component
Parameters:
- component: the name of the component under which to find the data monitor for deletion
- index: the integer index (0-based index) or string title of the data monitor being removed
Returns:
whether the data monitor was successfully found and deleted
Parameters:
- BSTR component
- VARIANT index
Return type: boolean
Function setUserName
void ModelCenter::IModelCenter::setUserName(BSTR userName)
Sets the user name that ModelCenter will use for authentication.
Parameters:
- userName: The user name.
Parameters:
- BSTR userName
Return type: void
Function setPassword
void ModelCenter::IModelCenter::setPassword(BSTR password)
Sets the password that ModelCenter will use for authentication.
Parameters:
- password: The password.
Parameters:
- BSTR password
Return type: void
Function getModelCenterPath
BSTR ModelCenter::IModelCenter::getModelCenterPath()
Returns the full path to where ModelCenter is installed.
Returns:
Full file path where ModelCenter is installed.
Return type: BSTR
Function getDataExplorer
IDispatch * ModelCenter::IModelCenter::getDataExplorer(int index)
Gets a pointer to the specified Data Explorer.
Parameters:
- index: The desired index number (0-based index).
Returns:
IDispatch* to an IDataExplorer object.
Parameters:
- int index
Return type: IDispatch *
Function getDataCollector
IDispatch * ModelCenter::IModelCenter::getDataCollector(int index)
Gets a pointer to the specified Data Collector.
Parameters:
- index: The desired index number (0-based index).
Returns:
IDispatch* to an IDataCollector object.
Parameters:
- int index
Return type: IDispatch *
Function getLogger
IDispatch * ModelCenter::IModelCenter::getLogger()
Gets the ILogger object used by ModelCenter for logging status and error messages.
Returns:
IDispatch* to an ILogger object.
Return type: IDispatch *
Function createPlugInFrame2
long ModelCenter::IModelCenter::createPlugInFrame2(BSTR name, BSTR title, BSTR reserved, LPDISPATCH plugIn, [optional]VARIANT showFavorites, [optional]VARIANT defaultHeight, [optional]VARIANT defaultWidth, [optional]VARIANT minimumHeight, [optional]VARIANT minimumWidth)
Creates a new frame window with favorites in it which can be used by Plug-Ins as a parent window in order to integrate with ModelCenter closer and to get favorites. Currently only supports C++ Plug-Ins.
Parameters:
- name: The programmatic name of the plug-in. This is used to store favorites and settings uniquely.
- title: The title to put on the frame
- reserved: Reserved, must be blank
- plugIn: An IDispatch to the plug-in, used to get at the to/from string to use with favorites.
- showFavorites:
- defaultHeight: The default height of the frame.
- defaultWidth: The default width of the frame.
- minimumHeight: The minimum allowed height of the frame.
- minimumWidth: The minimum allowed width of the frame.
Returns:
Parameters:
- BSTR name
- BSTR title
- BSTR reserved
- LPDISPATCH plugIn
- [optional] VARIANT showFavorites
- [optional] VARIANT defaultHeight
- [optional] VARIANT defaultWidth
- [optional] VARIANT minimumHeight
- [optional] VARIANT minimumWidth
Return type: long
Function moveComponent
void ModelCenter::IModelCenter::moveComponent(BSTR component, BSTR parent, [optional]VARIANT index)
Moves the component to the parent at the given index.
Parameters:
- component: The component to move.
- parent: Owning object of the component.
- index: Position in the parent.
Parameters:
- BSTR component
- BSTR parent
- [optional] VARIANT index
Return type: void
Function setAssemblyStyle
void ModelCenter::IModelCenter::setAssemblyStyle(BSTR assemblyName, AssemblyStyle style, [optional]VARIANT width, [optional]VARIANT height)
Sets the assembly style of the component (collapse, expanded, N^2, etc).
Parameters:
- assemblyName: The assembly the style will be set.
- style:
- width:
- height:
Parameters:
- BSTR assemblyName
- AssemblyStyle style
- [optional] VARIANT width
- [optional] VARIANT height
Return type: void
Function getAssemblyStyle
AssemblyStyle ModelCenter::IModelCenter::getAssemblyStyle(BSTR assemblyName, int *width, int *height)
Gets the style of the assembly (Collapsed, expanded, N^2, etc).
Parameters:
- assemblyName: The assembly to retrieve.
- width:
- height:
Returns:
AssemblyStyle
Parameters:
- BSTR assemblyName
- int * width
- int * height
Return type: AssemblyStyle
Function getAssembly
IDispatch * ModelCenter::IModelCenter::getAssembly(BSTR name)
Gets the assembly by the given name.
Parameters:
- name: The name of the assembly.
Returns:
IDispatch* to an IAssembly object.
Parameters:
- BSTR name
Return type: IDispatch *
Function createAndInitComponent
IDispatch * ModelCenter::IModelCenter::createAndInitComponent(BSTR serverPath, BSTR name, BSTR parent, BSTR initString, [optional]VARIANT xPos, [optional]VARIANT yPos)
Creates a new component and initializes it from string data.
?> This method can only be invoked on plug-ins which support IComponentPlugin.fromString(). Furthermore, it should only be used when you know exactly the format that is expected by the component's fromString() method. It is designed to be used from plug-ins in third-party software which need to initialize a matching component to connect to that software in the model.
Ideally, both the plug-in for the third-party software and the ModelCenter component will share the same codebase, so you can generate the configuration string from the same code which you will use to process it later. Mismatch between formats will almost certainly cause this method to fail.
Parameters:
- serverPath: The server path, e.g. "mcre:\localhost\block". You can get examples of server paths by looking at the component properties for existing ModelCenter components.
- name: The name of the new component.
- parent: The parent component.
- initString: The initialization string for the component. If NULL, the behavior of this function is identical to createComponent().
- xPos: The X position.
- yPos: The Y position.
Returns:
The newly created IComponent object
Parameters:
- BSTR serverPath
- BSTR name
- BSTR parent
- BSTR initString
- [optional] VARIANT xPos
- [optional] VARIANT yPos
Return type: IDispatch *
Function getLicensingPath
BSTR ModelCenter::IModelCenter::getLicensingPath()
Gets the licensing path used by ModelCenter. By default the path is the base ModelCenter install directory.
Returns:
Return type: BSTR
Function getMacroScript
BSTR ModelCenter::IModelCenter::getMacroScript(BSTR macroName)
Gets a macro script
?> This method is not safe for use from a component in parallel mode and will throw an exception if used in such a manner.
Parameters:
- macroName: The name of the macro.
Returns:
A string representing the macro script.
Parameters:
- BSTR macroName
Return type: BSTR
Function setMacroScript
void ModelCenter::IModelCenter::setMacroScript(BSTR macroName, BSTR script)
Sets a macro script
?> This method is not safe for use from a component in parallel mode and will throw an exception if used in such a manner.
Parameters:
- macroName: The name of the macro.
- script: The script text.
Parameters:
- BSTR macroName
- BSTR script
Return type: void
Function getMacroScriptLanguage
BSTR ModelCenter::IModelCenter::getMacroScriptLanguage(BSTR macroName)
Gets a macro script language
?> This method is not safe for use from a component in parallel mode and will throw an exception if used in such a manner.
Parameters:
- macroName: The name of the macro.
Returns:
A string representing the macro script language.
Parameters:
- BSTR macroName
Return type: BSTR
Function setMacroScriptLanguage
void ModelCenter::IModelCenter::setMacroScriptLanguage(BSTR macroName, BSTR language)
Sets the language for a macro script
?> This method is not safe for use from a component in parallel mode and will throw an exception if used in such a manner.
Parameters:
- macroName: The name of the macro.
- language: The macro script language.
Parameters:
- BSTR macroName
- BSTR language
Return type: void
Function addNewMacro
void ModelCenter::IModelCenter::addNewMacro(BSTR macroName, boolean isAppMacro)
Adds a new macro
Parameters:
- macroName: The name of the macro to show in the editor.
- isAppMacro: If true, the new macro will be an application macro. Otherwise, the new macro will be a model macro.
Parameters:
- BSTR macroName
- boolean isAppMacro
Return type: void
Function launchMacroEditor
void ModelCenter::IModelCenter::launchMacroEditor(BSTR macroName)
Launches the macro editor tool, and show the macro script corresponding to macroName
Parameters:
- macroName: the name of the macro to show in the editor. Just show the editor if the argument is null, or is not a valid macro name.
Parameters:
- BSTR macroName
Return type: void
Function startGUIMode
void ModelCenter::IModelCenter::startGUIMode([optional]VARIANT showDialogs)
THIS FUNCTION IS A BETA CAPABILITY
Normally when invoked via COM, ModelCenter is in "server" mode and it hides all GUI and dialogs. This method can be invoked immediately after instantiating the ModelCenter object to cause the GUI to be displayed.
Calling this method at any other time than immediately after creating the ModelCenter object is NOT SUPPORTED. Strange behavior or even crashes will likely ensue if it is called at any other time.
Once this method is invoked, ModelCenter may pop up GUI dialogs requiring user interaction at any time. This means your script may hang indefinitely if a user is not there to click through. For example, if a component fails to load on model load, the user would be prompted with the failed component dialog and the loadModel() api function would hang until the user answered the dialog.
Parameters:
- showDialogs: Boolean, that if true, will allow showing of startup dialogs such as the 'Recover Trade Study' dialog or 'Welcome to ModelCenter' dialog.
Parameters:
- [optional] VARIANT showDialogs
Return type: void
Function getNumUnitCategories
long ModelCenter::IModelCenter::getNumUnitCategories()
Returns the number of unit categories in the IModelCenter object.
Returns:
The number for unit categories, or -1 if there is an error.
Return type: long
Function getUnitCategoryName
BSTR ModelCenter::IModelCenter::getUnitCategoryName(long index)
Returns the name of the category of a unit.
Parameters:
- index: Index of the unit.
Returns:
The name of the category, or empty string if there is an error.
Parameters:
- long index
Return type: BSTR
Function getNumUnits
long ModelCenter::IModelCenter::getNumUnits(BSTR category)
Returns the number of units inside a specified category.
Parameters:
- category: Specified category of units.
Returns:
The number of units, or -1 if there is an error.
Parameters:
- BSTR category
Return type: long
Function getUnitName
BSTR ModelCenter::IModelCenter::getUnitName(BSTR category, long index)
Gets the name of the unit.
Parameters:
- category: Category to retrieve the unit.
- index: Index of the element in the category.
Returns:
The name of the unit, or empty string if there is an error.
Parameters:
- BSTR category
- long index
Return type: BSTR
Function createTradeStudy
IDispatch * ModelCenter::IModelCenter::createTradeStudy(BSTR type, [optional]VARIANT setup)
Launches the specified trade study.
Parameters:
- type: The string identifier for the trade study that should be started.
- setup: The setup string.
Returns:
An IDispatch* to the trade study object.
Parameters:
- BSTR type
- [optional] VARIANT setup
Return type: IDispatch *
Function getNetworkLocations
IDispatch * ModelCenter::IModelCenter::getNetworkLocations()
Return a reference to the Network Locations object
Returns:
An IDispatch* to the INetworkLocations object.
Return type: IDispatch *
Function saveVersionedModel
void ModelCenter::IModelCenter::saveVersionedModel(VersionStatus versionStatus, BSTR checkinMessage)
Saves the current Model.
Parameters:
- versionStatus: how to go about versioning the model (and its submodels)
- checkinMessage: check-in message to be associated with the model (and its submodels)
Parameters:
- VersionStatus versionStatus
- BSTR checkinMessage
Return type: void
Function saveVersionedModelAs
void ModelCenter::IModelCenter::saveVersionedModelAs(BSTR fileName, VersionStatus versionStatus, BSTR checkinMessage)
Saves the current Model to a specified file.
Parameters:
- fileName: Path to save the Model in.
- versionStatus: how to go about versioning the submodel (and its submodels)
- checkinMessage: check-in message to be associated with the model (and its submodels)
Parameters:
- BSTR fileName
- VersionStatus versionStatus
- BSTR checkinMessage
Return type: void
Function getVariableMetaData
LPDISPATCH ModelCenter::IModelCenter::getVariableMetaData(BSTR name)
Get metadata from a variable. Throws an exception if the variable is not found. Parameters:
- name: the full name of the variable
Returns:
the metadata, in the form of an IDHVariable (from PHXDATAHISTORYLib)
Parameters:
- BSTR name
Return type: LPDISPATCH
Function dumpComDebug
void ModelCenter::IModelCenter::dumpComDebug()
Dump COM debug information to TRACE(); only has an effect in debug builds.
Return type: void
Function showFileBrowseDialog
BSTR ModelCenter::IModelCenter::showFileBrowseDialog(BSTR title, [optional]VARIANT filters, [optional]VARIANT initialUri, [optional]VARIANT hwnd)
Displays file selection for loading dialog and returns URI of selected file. Parameters:
- title: title of dialog window
- filters: array of file type filters
- initialUri: initialUri to use in dialog
- hwnd: the window handle to which to parent the dialog
Returns:
URI of selected file, or empty string if none selected
Parameters:
- BSTR title
- [optional] VARIANT filters
- [optional] VARIANT initialUri
- [optional] VARIANT hwnd
Return type: BSTR
Function showFileSaveDialog
BSTR ModelCenter::IModelCenter::showFileSaveDialog(BSTR title, int *selectedFilter, [optional]VARIANT initialFilename, [optional]VARIANT filters, [optional]VARIANT initialUri, [optional]VARIANT hwnd)
Displays file selection for saving dialog and returns URI of selected file. Parameters:
- title: title of dialog window
- selectedFilter: the number of the filter selected
- initialFilename: the filename to populate the save dialog with
- filters: array of file type filters
- initialUri: initialUri to use in dialog
- hwnd: the window handle to which to parent the dialog
Returns:
URI of selected file, or empty string if none selected
Parameters:
- BSTR title
- int * selectedFilter
- [optional] VARIANT initialFilename
- [optional] VARIANT filters
- [optional] VARIANT initialUri
- [optional] VARIANT hwnd
Return type: BSTR
Function setLoginCallback
void ModelCenter::IModelCenter::setLoginCallback(IDispatch *callback)
Sets the login callback to use for authentication. Parameters:
- callback: callback to use
Parameters:
- IDispatch * callback
Return type: void
Function createDataHistoryVariable
IDispatch * ModelCenter::IModelCenter::createDataHistoryVariable()
Create an IDHVariable object.
Return type: IDispatch *
Function getRunOnlyMode
boolean ModelCenter::IModelCenter::getRunOnlyMode()
Gets the status of ModelCenter being in Run-Only Mode.
Returns:
true if ModelCenter is in Run-Only Mode; otherwise, false
Return type: boolean
Function setRunOnlyMode
void ModelCenter::IModelCenter::setRunOnlyMode(boolean shouldBeInRunOnly)
Sets the status of ModelCenter being in Run-Only Mode to the specified value.
Note: This function can only be called if it is the first function to be called on a new ModelCenter object; otherwise, it will throw an exception. This is to ensure that the correct ModelCenter license is checked out.
Parameters:
- shouldBeInRunOnly: true if ModelCenter should be in Run-Only Mode; otherwise, false
Parameters:
- boolean shouldBeInRunOnly
Return type: void
Function createDataExplorer
IDispatch * ModelCenter::IModelCenter::createDataExplorer(BSTR tradeStudyType, BSTR setup)
Creates a new Data Explorer. This documentation assumes you're creating it for a trade study; if you're not you can pass almost anything in for tradeStudyType or setup.
Parameters:
- tradeStudyType: Registry ID of the Plug-In. This is obtained by calling the getRegID method of the IAddToModel* object that is passed into the Plug-In's construct method.
- setup: A string that is generated from the Plug-In's "toString" method that can be restored later by the Plug-In's "fromString" method.
Returns:
IDispatch* to an PHXDATAEXPLORERLib::_DPHXDataExplorer object.
Parameters:
- BSTR tradeStudyType
- BSTR setup
Return type: IDispatch *
Function getFileSystemInfo
IDispatch * ModelCenter::IModelCenter::getFileSystemInfo(BSTR url)
Gets the FileSystemInfo for a given URL.
Parameters:
- url: the url for which to load a file system info
Parameters:
- BSTR url
Return type: IDispatch *
Function SAFEARRAY
ModelCenter::IModelCenter::SAFEARRAY(BSTR) getTradeStudyFilters()
Returns an array containing a list of FileDialog filters for ModelCenter trade study files. Returns:
SAFEARRAY of filters for use in FileDialog of the files used by trade studies
Parameters:
- BSTR
Return type:
Function saveTradeStudy
void ModelCenter::IModelCenter::saveTradeStudy(BSTR uri, int format, LPDISPATCH dataExplorer)
Save the trade study currently loaded in the DataExplorer to the given URI. It will overwrite the file if it exists. Note: Saving in pxt/pxtz formats will only save legacy plots and not the new plot types. Use tstudy(TS_FORMAT_TSTUDY) format to save all plots. Parameters:
- uri: the uri to write the trade study to
- format: the file format to be used when saving the trade study. Must be set to TS_FORMAT_TSTUDY. See TradeStudyFormat enumeration.
- dataExplorer: the data explorer from which to take trade study data
Parameters:
- BSTR uri
- int format
- LPDISPATCH dataExplorer
Return type: void
Function getDataCollectorForDataExplorer
IDispatch * ModelCenter::IModelCenter::getDataCollectorForDataExplorer(LPDISPATCH dataExplorer)
Retrieves a pointer to the Data Collector for the specified Data Explorer.
Parameters:
- dataExplorerPtr: The Data Explorer pointer for which to retrieve a Data Collector
Returns:
IDispatch* to the IDataCollector object for the specified Data Explorer
Parameters:
- LPDISPATCH dataExplorer
Return type: IDispatch *
Function launchDataCollectorPlugIn
void ModelCenter::IModelCenter::launchDataCollectorPlugIn(BSTR plugInName, LPDISPATCH dataExplorer)
Launches a specific Data Collector PlugIn, by name, on the specified Data Explorer.
Parameters:
- plugInName: The name of the Data Collector PlugIn to be launched
- dataExplorer: The Data Explorer for which to launch the PlugIn
Parameters:
- BSTR plugInName
- LPDISPATCH dataExplorer
Return type: void
Function guiLoadFile
boolean ModelCenter::IModelCenter::guiLoadFile(BSTR fileName)
Loads a file in "GUI" mode, that is, unlike loadFile(...), will produce a prompt to the user to verify whether or not any currently opened model should be saved prior to loading the given file.
Parameters:
- fileName: Path of the file to load.
Return values:
- true: if the save was not canceled
- false: if the save was canceled
Parameters:
- BSTR fileName
Return type: boolean
Function guiSaveModel
void ModelCenter::IModelCenter::guiSaveModel()
Saves the currently open file in "GUI" mode; unlike saveModel, this can pop up a save dialog (if the file has not already been saved). It will use ModelCenter's logic to determine what to do about versioned files.
Return type: void
Function getMacroTimeout
double ModelCenter::IModelCenter::getMacroTimeout(BSTR macroName)
Gets a macro's timeout.
?> This method is not safe for use from a component in parallel mode and will throw an exception if used in such a manner.
Parameters:
- macroName: The name of the macro.
Returns:
Number of seconds to allow a script to run before canceling it; -1 indicates no timeout.
Parameters:
- BSTR macroName
Return type: double
Function setMacroTimeout
void ModelCenter::IModelCenter::setMacroTimeout(BSTR macroName, double timeout)
Sets a macro's timeout.
?> This method is not safe for use from a component in parallel mode and will throw an exception if used in such a manner.
Parameters:
- macroName: The name of the macro.
- timeout: The number of seconds to allow a script to run before canceling it; -1 indicates no timeout.
Parameters:
- BSTR macroName
- double timeout
Return type: void
Function guiCloseAllMultiplexers
boolean ModelCenter::IModelCenter::guiCloseAllMultiplexers()
Attempts to close the DataExplorers of all vizualization multiplexers. Returns:
true if the user allowed all multiplexers to close.
Return type: boolean
Private functions
Function setAlternateParentFrame
void ModelCenter::IModelCenter::setAlternateParentFrame(long hwnd)
Parameters:
- long hwnd
Return type: void
Function destroyPlugInFrame
void ModelCenter::IModelCenter::destroyPlugInFrame(long hwnd)
Parameters:
- long hwnd
Return type: void
Function showPlugInFrame
void ModelCenter::IModelCenter::showPlugInFrame(long hwnd)
Parameters:
- long hwnd
Return type: void
Function hidePlugInFrame
void ModelCenter::IModelCenter::hidePlugInFrame(long hwnd)
Parameters:
- long hwnd
Return type: void
Function setIconPlugInFrame
void ModelCenter::IModelCenter::setIconPlugInFrame(long hwnd, BSTR iconFile)
Parameters:
- long hwnd
- BSTR iconFile
Return type: void
Function launchHTMLViewer
long ModelCenter::IModelCenter::launchHTMLViewer(BSTR url, boolean popup)
Parameters:
- BSTR url
- boolean popup
Return type: long
Function runAntFile
void ModelCenter::IModelCenter::runAntFile(BSTR fileName)
Parameters:
- BSTR fileName
Return type: void
Function getGlobalParameters
IDispatch * ModelCenter::IModelCenter::getGlobalParameters()
Return type: IDispatch *
Function closeHTMLViewer
boolean ModelCenter::IModelCenter::closeHTMLViewer(long hwnd)
Parameters:
- long hwnd
Return type: boolean
Function HTMLViewerWaitForClose
void ModelCenter::IModelCenter::HTMLViewerWaitForClose(long hwnd)
Parameters:
- long hwnd
Return type: void
Function HTMLViewerGetMyHWND
long ModelCenter::IModelCenter::HTMLViewerGetMyHWND()
Return type: long
Function getActiveJobManager
IDispatch * ModelCenter::IModelCenter::getActiveJobManager()
Return type: IDispatch *
Function getPreference
VARIANT ModelCenter::IModelCenter::getPreference(BSTR pref)
Gets preference value for the given key (pref). Note: Parses preference value in following order: Bool -> long -> double -> string Parameters:
- preference: (key) value to get value for
Returns:
preference value as a variant.
Parameters:
- BSTR pref
Return type: VARIANT
Function internalLicensing
void ModelCenter::IModelCenter::internalLicensing(BSTR, long)
Parameters:
- BSTR
- long
Return type: void
Function transformAVPoint
void ModelCenter::IModelCenter::transformAVPoint(int x, int y, boolean screen, VARIANT *tx, VARIANT *ty)
Parameters:
- int x
- int y
- boolean screen
- VARIANT * tx
- VARIANT * ty
Return type: void
Function parallelInstance
IDispatch * ModelCenter::IModelCenter::parallelInstance()
Return type: IDispatch *
Function unAssociatedInstance
IDispatch * ModelCenter::IModelCenter::unAssociatedInstance()
Return type: IDispatch *
Function configureLogging
void ModelCenter::IModelCenter::configureLogging(boolean enableLogging)
Configures the ModelCenter logger, currently used for testing.
Parameters:
- enableLogging: Set to true to enable the logger.
Parameters:
- boolean enableLogging
Return type: void
Function setXMLExtension
void ModelCenter::IModelCenter::setXMLExtension(BSTR xml)
Adds the XML as an XML extension node to the model file.
Parameters:
- xml: The XML string.
Parameters:
- BSTR xml
Return type: void
Function getXMLExtension
BSTR ModelCenter::IModelCenter::getXMLExtension(BSTR nodeName, BSTR attributeName, BSTR attributeValue)
Gets an XML extension node from the model file that matches the specified query.
Parameters:
- nodeName: Name of the XML root tag.
- attributeName: Name of a distinguishing attribute for the XML tag.
- attributeValue: Value of the attribute.
Returns:
Parameters:
- BSTR nodeName
- BSTR attributeName
- BSTR attributeValue
Return type: BSTR
Function setPreference
void ModelCenter::IModelCenter::setPreference(BSTR pref, BSTR value)
Parameters:
- BSTR pref
- BSTR value
Return type: void