ModelCenter
Last update: 30.07.2026public class ModelCenter : PHXCOMObject, IModelCenter
This is the wrapper class that handles the native COM calls to ModelCenter. The class is used by Java plug-ins to ModelCenter or by stand-alone Java programs to interact with ModelCenter.
Example:
try
{
ModelCenter mc = new ModelCenter();
mc.loadModel( "d:\\test.pxc" );
for ( int x = 0; x < 10; x++ )
{
System.out.print( "x = " + x );
mc.setValue( "Model.Script.x", "" + x );
System.out.println( ", y = " + mc.getValue( "Model.Script.y" ) );
}
mc.close();
}
catch ( ModelCenterException e )
{
e.printStackTrace();
}
Author
Woyak, 9-01
Constructors
| ModelCenter | constructor() default constructor. constructor(optionStr: String) default constructor. constructor(pstrm: Long, f: JFrame) Connects this Java object to the specified session of ModelCenter. constructor(pstrm: Long, f: JFrame, addRef: Boolean) Connects this Java object to the specified session of ModelCenter. |
Types
| Name | Summary |
|---|---|
| AssemblyStyle | enum AssemblyStyle Ways to display an assembly. |
| AssemblyStyleInfo | public class AssemblyStyleInfo Information about an assembly's visual style. |
| VersionStatus | enum VersionStatus Ways to version a file |
Properties
| Name | Summary |
|---|---|
| ASSEMBLY_TYPE_ASSEMBLY | val ASSEMBLY_TYPE_ASSEMBLY: String = "Assembly" |
| ASSEMBLY_TYPE_FOR_EACH | val ASSEMBLY_TYPE_FOR_EACH: String = "ForEach" |
| ASSEMBLY_TYPE_IF | val ASSEMBLY_TYPE_IF: String = "If" |
| ASSEMBLY_TYPE_PARALLEL | val ASSEMBLY_TYPE_PARALLEL: String = "Parallel" |
| ASSEMBLY_TYPE_SEQUENCE | val ASSEMBLY_TYPE_SEQUENCE: String = "Sequence" |
| CONN_ERR_ERROR | val CONN_ERR_ERROR: Int = 3 |
| CONN_ERR_IGNORE | val CONN_ERR_IGNORE: Int = 1 |
| CONN_ERR_USEDIALOG | val CONN_ERR_USEDIALOG: Int = -1 |
| MODEL_TYPE_DATA | val MODEL_TYPE_DATA: String = "dataModel" |
| MODEL_TYPE_PROCESS | val MODEL_TYPE_PROCESS: String = "processModel" |
Functions
| Name | Summary |
|---|---|
| addIcon | public addIcon(iconFile: String): Int Registers an icon with ModelCenter. |
| addNewMacro | public addNewMacro(macroName: String, isAppMacro: Boolean) adds a new Macro to ModelCenter's macro facility |
| allowBringWindowToFront | public allowBringWindowToFront(processID: Long) Use OS calls to allow another process to bring a window to the front. |
| autoLink | public autoLink(srcComp: String, destComp: String) auto links the variables of two Components |
| breakLink | public breakLink(variable: String) Breaks the link of a specified variable |
| checkout | public checkout(feature: String): Feature Should check out a license feature from Ansys |
| checkout2 | public checkout2(feature: String, productRelease: String): Feature Should check out a license feature from Ansys |
| close | public close() closes ModelCenter. |
| closeHTMLViewer | public closeHTMLViewer(hwnd: Long): Boolean closes the HTMLViewer embedded browser tool |
| closeModel | public closeModel() closes the model within ModelCenter |
| createAndInitComponent | public createAndInitComponent(serverPath: String, name: String, parentName: String, initString: String, xPos: Long, yPos: Long): Component Creates a new component and initializes it from string data. |
| createAssembly | public createAssembly(name: String, parent: String): Assembly public createAssembly(name: String, parent: String, assemblyType: String): Assembly creates an assembly |
| createAssemblyVariable | public createAssemblyVariable(name: String, type: String, parent: String): Variable creates an assembly variable |
| createComponent | public createComponent(serverPath: String, name: String, parentName: String) public createComponent(serverPath: String, name: String, parentName: String, xPos: Long, yPos: Long) Instantiates a new component into the Model |
| createDataCollector | public creates a Data Collector for storing and displaying data |
| createDataExplorer | public createDataExplorer(tradeStudyType: String, setup: String): DataExplorer creates a Data Explorer for storing and displaying data |
| createDataHistoryVariable | public createDataHistoryVariable(): DHVariable Creates a new DHVariable instance. |
| createDataMonitor | public createDataMonitor(component: String, title: String, x: Int, y: Int): DataMonitor create a data monitor and associate it with a particular component |
| createJobManager | public createJobManager(): JobManager creates a JobManager object for performing trade study runs public createJobManager(showProgressDialog: Boolean): JobManager public createJobManager(progressDialogParent: Long): JobManager Creates a JobManager for performing trade study runs. |
| createLink | public createLink(varName: String, equation: String) Creates a new link |
| createPlugInFrame | public createPlugInFrame(name: String, title: String, reserved: String, plugin: Long, container: Container): Long Create a frame window in which to embed the java plug-in public createPlugInFrame(name: String, title: String, reserved: String, plugin: Long, container: Container, showFavorites: Boolean): Long public createPlugInFrame(name: String, title: String, reserved: String, plugin: Long, container: Container, showFavorites: Boolean, defWidth: Long, defHeight: Long): Long public createPlugInFrame(name: String, title: String, reserved: String, plugin: Long, container: Container, showFavorites: Boolean, defWidth: Long, defHeight: Long, minWidth: Long, minHeight: Long): Long |
| createTradeStudy | public createTradeStudy(idStr: String): TradeStudy Creates the specified trade study and returns a handle to it. |
| destroyPlugInFrame | public destroyPlugInFrame(hwnd: Long) Destroys the frame window which the java plug-in is embedded in |
| disableGC | public disableGC(gc: Boolean) If true, prevents releaseObjects from doing anything. |
| dumpComDebug | public dumpComDebug() Dumps COM debugging information on the ModelCenter process side; only has an effect if ModelCenter is compiled in Debug mode. |
| getActiveJobManager | public getActiveJobManager(): JobManager Gets the Job Manager associated with the currently running trade study. |
| getAppName | public getAppName(): String Gets the Application name |
| getAssembly | public getAssembly(name: String): Assembly Gets the specified assembly from the model. |
| getAssemblyStyle | public getAssemblyStyle(assemblyName: String): ModelCenter.AssemblyStyleInfo Get the visual style of an assembly. |
| getComponent | public getComponent(name: String): Component Gets the specified component from the Model |
| getDataCollector | public getDataCollector(index: Long): DataCollector |
| getDataCollectorForDataExplorer | public getDataCollectorForDataExplorer(dataExplorer: DataExplorer): DataCollector Retrieves a DataCollector for the DataExplorer with the specified ID. |
| getDataExplorer | public getDataExplorer(id: Variant): DataExplorer gets a specific DataExplorer |
| getDataMonitor | public getDataMonitor(component: String, index: Variant): DataMonitor gets a specific data monitor associated with a particular component |
| getFileSystemInfo | public getFileSystemInfo(uri: String): FileSystemInfo Gets the FileSystemInfo for a given URI. |
| getFormatter | public getFormatter(format: String): Format Gets an instance of a formatter object |
| getFrame | public getFrame(): JFrame gets a Frame that should be used as the parent for all windows displayed by Java plug-ins. |
| getGlobalParameters | public getGlobalParameters(): GlobalParameters Gets the list of global parameters |
| getHaltStatus | public getHaltStatus(): Boolean checks to see if the halt button has been pressed |
| getIsInteractive | public getIsInteractive(): Boolean Determine if the current ModelCenter is running interactively - that is, if it has a GUI and a main window. |
| getLastErrorMessage | public getLastErrorMessage(): String retrieves the text associated with the last ModelCenter error |
| getLicensingPath | public getLicensingPath(): String Gets the ModelCenter licensing path returns ModelCenter licensing path |
| getLinks | public getLinks(includeReferences: Boolean): VariableLinks Retreive a list of all links in a model |
| getLogger | public getLogger(): Logger Retrieves a logger. |
| getMacroScript | public getMacroScript(macroName: String): String get the script for a macro if the macro exists |
| getMacroScriptLanguage | public getMacroScriptLanguage(macroName: String): String get the script language for a macro if the macro exists |
| getMacroTimeout | public getMacroTimeout(macroName: String): Double get the timeout for a macro if the macro exists |
| getModel | public getModel(): Assembly Gets the Model object |
| getModelCenterPath | public getModelCenterPath(): String Retrieves the install path for ModelCenter. |
| getModelDirectory | public getModelDirectory(): String Gets the Model directory returns an exception when Model is not open returns an empty string when Model has not been saved |
| getModelFileName | public getModelFileName(): String Gets the Model file name |
| getPreference | public getPreference(prefName: String): Variant gets a preference |
| getProcessID | public getProcessID(): Long Retrieves the process identifier (PID) of the ModelCenter process. |
| getRunOnlyMode | public getRunOnlyMode(): Boolean Gets the status of ModelCenter being in Run-Only Mode. |
| getScreenUpdating | public getScreenUpdating(): Boolean returns the current screen updating flag |
| getTradeStudyFilters | public getTradeStudyFilters(): Array<String> Get the filters for saving Trade Study files (for use in showFileBrowseDialog and showFileSaveDialog) |
| getValue | public getValue(name: String): Variant gets a value for the specified variable |
| getValueAbsolute | public getValueAbsolute(name: String): Variant gets a value for the specified variable without validating it |
| getVariable | public getVariable(name: String): Variable Gets the specified variable from the Model |
| getVariableMetaData | public getVariableMetaData(name: String): DHVariable Get metadata about the specified variable from the Model. |
| getVersion | public getVersion(index: Int): Int Gets the ModelCenter version |
| getXMLExtension | public getXMLExtension(nodeName: String, attributeName: String, attributeValue: String): String For internal use only. |
| guiCloseAllMultiplexers | public guiCloseAllMultiplexers(): Boolean Attempts to close the DataExplorers of all vizualization multiplexers. |
| guiLoadFile | public guiLoadFile(modelFile: String): Boolean 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. |
| guiSaveModel | public guiSaveModel() Saves a file in "GUI" mode, which will pop up a dialog if the file has not yet been saved. |
| halt | public halt() Halts any running trade studies |
| hidePlugInFrame | public hidePlugInFrame(hwnd: Long) Hides the frame window which the java plugin is embedded in |
| HTMLViewerWaitForClose | public HTMLViewerWaitForClose(hwnd: Long) waits for the HTMLViewer embedded browser tool to close |
| internalLicensing | public internalLicensing(one: String, two: Long) For internal use only |
| invokeHelp | public invokeHelp(helpID: Int) Display a topic in ModelCenter's help system |
| isOkToClose | public isOkToClose(): Boolean Determine whether it's ok to shutdown ModelCenter or whether there are still windows open |
| launchDataCollectorPlugIn | public launchDataCollectorPlugIn(plugInName: String, dataExplorer: DataExplorer) Launches a specific Data Collector PlugIn, by name, on the specified Data Explorer. |
| launchHTMLViewer | public launchHTMLViewer(url: String, popup: Boolean): Long starts the HTMLViewer embedded browser tool |
| launchMacroEditor | public launchMacroEditor(macroName: String) launches the macro editor, displays the macro scrip if it exists |
| launchTradeStudy | public launchTradeStudy(idStr: String) Launches the specified trade study. |
| loadFile | public loadFile(modelFile: String) public loadFile(modelFile: String, connectErrorMode: Int) opens the specified Model |
| loadModel | public loadModel(modelFile: String) public loadModel(modelFile: String, connectErrorMode: Int) opens the specified Model |
| MessageBox | public MessageBox(msg: String) displays a Windows Message Box |
| moveComponent | public moveComponent(component: String, parent: String, index: Int) Moves a component. |
| newInstance | public newInstance(): ModelCenter creates a new ModelCenter object (that is connected to the same ModelCenter session) that is not currently attached to any thread. |
| newModel | public newModel() loads ModelCenter with a new, empty Model (data dependency model - MODEL_TYPE_DATA) public newModel(modelType: String) loads ModelCenter with a new, empty Model |
| parallelInstance | public parallelInstance(): ModelCenter For internal use only |
| release | public release() Releases the COM reference to ModelCenter for this object. |
| releaseObjects | public releaseObjects() This function attempts to release any COM resources left behind from objects which have been finalized but release() was never called on them. |
| removeComponent | public removeComponent(component: String) Removes a specified component |
| removeDataMonitor | public removeDataMonitor(component: String, index: Variant): Boolean remove a specific data monitor associated with a particular component |
| run | public run(variableArray: String) A comma-separated list of ModelCenter variables to validate. |
| runAntFile | public runAntFile(fileName: String) runs an ANT testing file |
| runMacro | public runMacro(macroName: String): Variant runs a macro |
| runMacro2 | public runMacro2(macroName: String): Variant runs a macro and passes the current modelCenter object to the script (i.e. |
| saveModel | public saveModel() saves the current Model with it's existing file name |
| saveModelAs | public saveModelAs(fileName: String) saves the current Model with the specified file name |
| saveTradeStudy | public saveTradeStudy(uri: String, fileType: Int, dataExplorer: DataExplorer) Save the trade study inside of the Data Explorer |
| saveVersionedModel | public saveVersionedModel(versionStatus: ModelCenter.VersionStatus, checkinMessage: String) saves the current Model with it's existing file name |
| saveVersionedModelAs | public saveVersionedModelAs(fileName: String, versionStatus: ModelCenter.VersionStatus, checkinMessage: String) saves the current Model with the specified file name |
| setAssemblyStyle | public setAssemblyStyle(assemblyName: String, style: ModelCenter.AssemblyStyle) Set the visual style of an assembly. public setAssemblyStyle(assemblyName: String, style: ModelCenter.AssemblyStyle, width: Int, height: Int) Set the visual style of an assembly including (optionally) width and height. |
| setIconPlugInFrame | public setIconPlugInFrame(hwnd: Long, iconFile: String) Sets the icon for the frame window which the java plugin is embedded in |
| setLoginCallback | public setLoginCallback(callback: ILoginCallback) Set the login callback to use |
| setMacroScript | public setMacroScript(macroName: String, script: String) set the script for a macro if the macro exists |
| setMacroScriptLanguage | public setMacroScriptLanguage(macroName: String, language: String) set the script lancuage for a macro if the macro exists |
| setMacroTimeout | public setMacroTimeout(macroName: String, timeout: Double) sets the timeout for a macro if the macro exists |
| setPassword | public setPassword(password: String) Sets the global default password combination in ModelCenter |
| setPreference | public setPreference(prefName: String, value: String) Sets a preference |
| setReferenceDebugMode | public setReferenceDebugMode(on: Boolean) When set to true, the system will keep a list of active COM objects that are allocated but not yet released since this method was invoked. |
| setRunOnlyMode | public setRunOnlyMode(shouldBeInRunOnly: Boolean) Sets the status of ModelCenter being in Run-Only Mode to the specified value. |
| setScheduler | public setScheduler(scheduler: String) Sets the appropriate schdeuler. |
| setScreenUpdating | public setScreenUpdating(flag: Boolean) sets a flag indicating if the ModelCenter window should update due to Model changes. |
| setUserName | public setUserName(username: String) Sets the global default username combination in ModelCenter |
| setValue | public setValue(varName: String, value: String) sets the value for the specified variable |
| setXMLExtension | public setXMLExtension(xml: String) For internal use only. |
| showFileBrowseDialog | public showFileBrowseDialog(title: String, filters: Array<String>, initialUri: String): String public showFileBrowseDialog(title: String, filters: Array<String>, initialUri: String, hwnd: Long): String Displays file selection dialog for loading and returns URL of selected file. |
| showFileSaveDialog | public showFileSaveDialog(title: String, selectedFilter: ValueHolder<Integer>, initialFileName: String, filters: Array<String>, initialUri: String, hwnd: Long): String Displays file selection dialog for saving and returns URL of selected file. |
| showPlugInFrame | public showPlugInFrame(hwnd: Long) Shows the frame window which the java plugin is embedded in |
| startGUIMode | public startGUIMode(showDialogs: Boolean) THIS FUNCTION IS A BETA CAPABILITY Normally when invoked via COM, ModelCenter is in "server" mode and it hides all GUI and dialogs. |
| tradeStudyEnd | public tradeStudyEnd() lets ModelCenter know that a trade study is ending |
| tradeStudyStart | public tradeStudyStart() lets ModelCenter know that a trade study is beginning |