Skip to main content

ModelCenter APIs 2026 R1 SP03

Interface ModelCenter::IAddToModel

Last update: 30.07.2026

Definition: ModelCenter/src/ModelCenter.odl (line 121)

COM Instance.

Examples:

Adding to the Model:

This example is of adding a Trade Study or Data Collector Plug-In to the Model as a Component.

Dim atm As IAddToModel

atm.addInput "x", "double", "0"
atm.addInput "x2", "double", "0"
atm.addOutput "y", "double", "0"
atm.addToModel

Adding an input:

A sample Component Plug-In has input x and output y. Add another input x2.

Dim atm As IAddToModel

atm.addInput "x", "double", "0"
atm.addInput "x2", "double", "0"
atm.addOutput "y", "double", "0"
atm.updateComponent

Removing an output:

A sample Component Plug-In has input x and outputs y, y2. Remove the y2 variable.

Dim atm As IAddToModel

atm.addInput "x", "double", "0"
atm.addOutput "y", "double", "0"
atm.updateComponent

Members

Properties

Property prevalidateInputs

Definition: ModelCenter/src/ModelCenter.odl (line 1)

boolean ModelCenter::IAddToModel::prevalidateInputs

Whether or not pre-validate inputs before running is turned on for the Component.

Returns:

yes(TRUE) or no(FALSE).

Example demonstrating how to set the prevalidateInputs property of the Component:

Dim atm As IAddToModel

atm.prevalidateInputs=false

Return type: boolean

Property autoRun

Definition: ModelCenter/src/ModelCenter.odl (line 1)

boolean ModelCenter::IAddToModel::autoRun

Whether or not auto-run if inputs change is turned on for the Component.

Returns:

yes(TRUE) or no(FALSE).

Example demonstrating how to set the autoRun property:

Dim atm As IAddToModel

atm.autoRun=True

Return type: boolean

Public functions

Function addToModel

void ModelCenter::IAddToModel::addToModel()

Adds a Trade Study or Data Collector Plug-In to the Model as a Component Plug-In. This method is not allowed to be called in the run() method.

Return type: void

Function updateComponent

void ModelCenter::IAddToModel::updateComponent()

Reinitializes the inputs and outputs of a Component Plug-In. The addInput() and addOutput() methods must be called for each input and output for the new configuration before calling updateComponent(). This method is not allowed to be called in the run() method.

Return type: void

Function getComponent

IDispatch * ModelCenter::IAddToModel::getComponent()

Gets a pointer to the IAddToModel object's IComponent object.

Returns:

IDispatch* to an IComponent object.

Return type: IDispatch *

Function getRegID

BSTR ModelCenter::IAddToModel::getRegID()

Gets the Plug-In Registry ID that is required for the createDataCollector method in the IModelCenter object. ModelCenter must must know the Registry ID of the Plug-In so Trade Study Files can be saved/restored if the user chooses to do so.

Example demonstrating how to query the IAddToModel object for the Registry ID:

Dim atm As IAddToModel

Dim Str As String
Str=atm.getRegID()

Returns:

Registry ID of the Plug-In.

Return type: BSTR

Function addInput

IDispatch * ModelCenter::IAddToModel::addInput(BSTR name, BSTR type, [optional]VARIANT value)

Adds a pending input variable to the IAddToModel object IO structure. The IAddToModel object's input variables are updated when the addToModel() or updateComponent() methods are called.

Parameters:

  • name: The name of the pending variable.

  • type: The type of the variable. Add "[]" to the end of the type to indicate an array.
    Valid types include:

  • "double" - double

  • "int" - integer

  • "string" - string

  • "bool" - boolean

  • "ref" - reference

  • "file" - A binary or ascii file

  • "object" - object variable (The default class type "PHXNonStrictType" will be used)

  • "quad" - Quad Facet Geometry, a geometry type composed of multiple quadrilaterals.

  • "sor" - Surface of Revolution, a geometry type defined by a profile curve rotated about an axis.

  • "nurbs" - A geometry type for NURBS.

  • "bspline" - A geometry type for B-Spline curves.

  • "ruled" - A geometry type for ruled surfaces.

  • "skinned" - A geometry type for skinned surfaces.

  • "node" - A geometry type for displaying multiple points in space.

  • value: Value of the variable. If the variable is an array, then each variable value should be separated by a semi-colon:
    addInput( "myVar", "double[]", "0;1;2.3;4.56" )

Returns:

IDispatch* to an IVariable object

Parameters:

  • BSTR name
  • BSTR type
  • [optional] VARIANT value

Return type: IDispatch *

Function addOutput

IDispatch * ModelCenter::IAddToModel::addOutput(BSTR name, BSTR type, [optional]VARIANT value)

Adds a pending output variable to the IAddToModel object IO structure. The IAddToModel object's output variables are updated when the addToModel() or updateComponent() methods are called.

Parameters:

  • name: The name of the pending variable.

  • type: The type of the variable. Add "[]" to the end of the type to indicate an array.
    Valid types include:

  • "double" - double

  • "int" - integer

  • "string" - string

  • "bool" - boolean

  • "ref" - reference

  • "file" - A binary or ascii file

  • "object" - object variable (The default class type "PHXNonStrictType" will be used)

  • "quad" - Quad Facet Geometry, a geometry type composed of multiple quadrilaterals.

  • "sor" - Surface of Revolution, a geometry type defined by a profile curve rotated about an axis.

  • "nurbs" - A geometry type for NURBS.

  • "bspline" - A geometry type for B-Spline curves.

  • "ruled" - A geometry type for ruled surfaces.

  • "skinned" - A geometry type for skinned surfaces.

  • "node" - A geometry type for displaying multiple points in space.

  • value: Value of the variable. If the variable is an array, then each variable value should be separated by a semi-colon:
    addInput( "myVar", "double[]", "0;1;2.3;4.56" )

Returns:

IDispatch* to an IVariable object

Parameters:

  • BSTR name
  • BSTR type
  • [optional] VARIANT value

Return type: IDispatch *

Function getProgID

BSTR ModelCenter::IAddToModel::getProgID()

Gets the ProgID for COM Plug-Ins. The ProgID is the the string used to create an instance of a COM object (ex. "Phoenix.myPlugIn").

Example demonstrating how to get the ProgID of a Plug-In:

Dim atm As IAddToModel

Dim Str As String
Str=atm.getProgID()

Returns:

ProgID of the COM Plug-In.

Return type: BSTR

Function setAuthor

void ModelCenter::IAddToModel::setAuthor(BSTR author)

Defines the author of this Plug-In. Use this method to set the Component metadata when you add a Trade Study or Data Collector Plug-In to the Model.

Parameters:

  • author: The author of this Plug-In.

Parameters:

  • BSTR author

Return type: void

Function setDescription

void ModelCenter::IAddToModel::setDescription(BSTR description)

Defines the description of this Plug-In. Use this method to set the Component metadata when you add a Trade Study or Data Collector Plug-In to the Model.

Parameters:

  • description: The description for this Plug-In.

Parameters:

  • BSTR description

Return type: void

Function setVersion

void ModelCenter::IAddToModel::setVersion(BSTR version)

Defines the version of this Plug-In. Use this method to set the Component metadata when you add a Trade Study or Data Collector Plug-In to the Model.

Parameters:

  • version: The version information for this Plug-In.

Parameters:

  • BSTR version

Return type: void

Function setHelpURL

void ModelCenter::IAddToModel::setHelpURL(BSTR helpURL)

Defines the help URL of this Plug-In. Use this method to set the Component metadata when you add a Trade Study or Data Collector Plug-In to the Model.

Parameters:

  • helpURL: The help URL for this Plug-In.

Parameters:

  • BSTR helpURL

Return type: void

Function setKeywords

void ModelCenter::IAddToModel::setKeywords(BSTR keywords)

Defines the keywords for this Plug-In. Use this method to set the Component metadata when you add a Trade Study or Data Collector Plug-In to the Model.

Parameters:

  • keywords: The keywords for this Plug-In.

Parameters:

  • BSTR keywords

Return type: void

Function clearBusyFlag

void ModelCenter::IAddToModel::clearBusyFlag()

Clears the busy state of ModelCenter.

Return type: void

Function addToModel2

boolean ModelCenter::IAddToModel::addToModel2()

Adds a Trade Study or Data Collector Plug-In to the Model as a Component Plug-In. This method is not allowed to be called in the run() method.

Returns:

Whether or not the operation completed successfully.

Return type: boolean

Function setComponentRequirements

void ModelCenter::IAddToModel::setComponentRequirements(BSTR compReq)

Defines the requirements for this Plug-In. Use this method to set the Component metadata when you add a Trade Study or Data Collector Plug-In to the Model.

Parameters:

  • compReq: A comma separated list of requirement specifiers for this Plug-In.

Parameters:

  • BSTR compReq

Return type: void

Function setIcon

void ModelCenter::IAddToModel::setIcon(BSTR iconFile)

Sets the Plug-In icon. Parameters:

  • iconFile: The file path to the icon file.

Parameters:

  • BSTR iconFile

Return type: void

Function addMethod

void ModelCenter::IAddToModel::addMethod(BSTR name, [optional]VARIANT displayName)

Adds the method.

Parameters:

  • name: The name of the method.
  • displayName: The display name of the method.

Parameters:

  • BSTR name
  • [optional] VARIANT displayName

Return type: void

Function addInput2

IDispatch * ModelCenter::IAddToModel::addInput2(BSTR name, BSTR type, BSTR classURL, [optional]VARIANT value)

Adds a pending input variable to the IAddToModel object IO structure. The IAddToModel object's input variables are updated when the addToModel() or updateComponent() methods are called. This method can be used to add an "object" variable with a specified class type.

Parameters:

  • name: The name of the pending variable.

  • type: The type of the variable. Add "[]" to the end of the type to indicate an array.
    Valid types include:

  • "double" - double

  • "int" - integer

  • "string" - string

  • "bool" - boolean

  • "ref" - reference

  • "file" - A binary or ascii file

  • "object" - object variable (The default class type "PHXNonStrictType" will be used if classURL is empty)

  • "quad" - Quad Facet Geometry, a geometry type composed of multiple quadrilaterals.

  • "sor" - Surface of Revolution, a geometry type defined by a profile curve rotated about an axis.

  • "nurbs" - A geometry type for NURBS.

  • "bspline" - A geometry type for B-Spline curves.

  • "ruled" - A geometry type for ruled surfaces.

  • "skinned" - A geometry type for skinned surfaces.

  • "node" - A geometry type for displaying multiple points in space.

  • classURL: Class of the object variable. If an empty string is passed, PHXNonStrictType will be used.

  • value: Value of the variable. If the variable is an array, then each variable value should be separated by a semi-colon:
    addInput( "myVar", "double[]", "0;1;2.3;4.56" )

Returns:

IDispatch* to an IVariable object

Parameters:

  • BSTR name
  • BSTR type
  • BSTR classURL
  • [optional] VARIANT value

Return type: IDispatch *

Function addOutput2

IDispatch * ModelCenter::IAddToModel::addOutput2(BSTR name, BSTR type, BSTR classURL, [optional]VARIANT value)

Adds a pending output variable to the IAddToModel object IO structure. The IAddToModel object's output variables are updated when the addToModel() or updateComponent() methods are called.

Parameters:

  • name: The name of the pending variable.

  • type: The type of the variable. Add "[]" to the end of the type to indicate an array.
    Valid types include:

  • "double" - double

  • "int" - integer

  • "string" - string

  • "bool" - boolean

  • "ref" - reference

  • "file" - A binary or ascii file

  • "object" - object variable (The default class type "PHXNonStrictType" will be used)

  • "quad" - Quad Facet Geometry, a geometry type composed of multiple quadrilaterals.

  • "sor" - Surface of Revolution, a geometry type defined by a profile curve rotated about an axis.

  • "nurbs" - A geometry type for NURBS.

  • "bspline" - A geometry type for B-Spline curves.

  • "ruled" - A geometry type for ruled surfaces.

  • "skinned" - A geometry type for skinned surfaces.

  • "node" - A geometry type for displaying multiple points in space.

  • classURL: Class of the object variable. If an empty string is passed, PHXNonStrictType will be used.

  • value: Value of the variable. If the variable is an array, then each variable value should be separated by a semi-colon:
    addInput( "myVar", "double[]", "0;1;2.3;4.56" )

Returns:

IDispatch* to an IVariable object

Parameters:

  • BSTR name
  • BSTR type
  • BSTR classURL
  • [optional] VARIANT value

Return type: IDispatch *

Function addToModel3

BSTR ModelCenter::IAddToModel::addToModel3(BSTR suggestedName)

Adds a Trade Study or Data Collector Plug-In to the Model as a Component Plug-In. This method is not allowed to be called in the run() method.

Parameters:

  • suggestedName: Desired name for the component. This name will be used unless a component of that name already exists, in which case the variable name will be the desired name plus a number tagged on to the end.

Returns:

Whether or not the operation completed successfully.

Parameters:

  • BSTR suggestedName

Return type: BSTR

Connect with Ansys