Skip to main content

ModelCenter APIs 2025 R1

Interface ModelCenter::IFileVariable

Last update: 16.07.2025

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

COM Instance

Inherits from:

Members

Properties

Property hasChanged

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

boolean ModelCenter::IFileVariable::hasChanged

Return type: boolean

Property hide

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

boolean ModelCenter::IFileVariable::hide

Return type: boolean

Property OwningComponent

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

LPDISPATCH ModelCenter::IFileVariable::OwningComponent

Return type: LPDISPATCH

Property value

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

BSTR ModelCenter::IFileVariable::value

Value of the variable.

Return type: BSTR

Property isBinary

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

boolean ModelCenter::IFileVariable::isBinary

Whether or not the file is binary.

Return type: boolean

Property fileExtension

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

BSTR ModelCenter::IFileVariable::fileExtension

File extension of the variable. Used when opening the file in ModelCenter.

Return type: BSTR

Property description

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

BSTR ModelCenter::IFileVariable::description

The description of the variable.

Return type: BSTR

Property saveWithModel

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

boolean ModelCenter::IFileVariable::saveWithModel

Flag to indicate whether the file content to be saved with the Model file.

Return type: boolean

Property directTransfer

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

boolean ModelCenter::IFileVariable::directTransfer

Flag to indicate whether direct file transfer is used for incoming link.

Return type: boolean

Public functions

Function isValid

boolean ModelCenter::IFileVariable::isValid()

Returns whether or not the variable is valid.

Returns:

True if variable is valid. False if the variable is not valid.

Return type: boolean

Reimplements: isValid

Function validate

void ModelCenter::IFileVariable::validate()

Validates the variable by running the component if needed.

Return type: void

Reimplements: validate

Function getName

BSTR ModelCenter::IFileVariable::getName()

Gets the name of the variable.

Returns:

The name of the variable.

Return type: BSTR

Reimplements: getName

Function getFullName

BSTR ModelCenter::IFileVariable::getFullName()

Gets the full ModelCenter path of the variable.

Returns:

The full ModelCenter path of the variable.

Return type: BSTR

Reimplements: getFullName

Function getType

BSTR ModelCenter::IFileVariable::getType()

Gets the type of the variable.

Returns:

The type of the variable as a string.

Return type: BSTR

Reimplements: getType

Function isInput

boolean ModelCenter::IFileVariable::isInput()

Finds out whether or not the variable is an input with respect to the model. Returns the same value as isInputToModel.

Return values:

  • true: Input
  • false: Output

Return type: boolean

Reimplements: isInput

Function toString

BSTR ModelCenter::IFileVariable::toString()

Converts the variable value to a string, validating the variable if necessary.

Returns:

The value of the variable as a string.

Return type: BSTR

Reimplements: toString

Function fromString

void ModelCenter::IFileVariable::fromString(BSTR value)

Sets the value of the variable from the specified string.

Parameters:

  • value: New value.

Parameters:

  • BSTR value

Return type: void

Reimplements: fromString

Function toStringAbsolute

BSTR ModelCenter::IFileVariable::toStringAbsolute()

Converts the value of the variable to a string.

Returns:

The value of the variable as a string.

Return type: BSTR

Reimplements: toStringAbsolute

Function invalidate

void ModelCenter::IFileVariable::invalidate()

Marks the variable as invalid (needs to be computed). This will set all dependent variables invalid also.

Return type: void

Reimplements: invalidate

Function directPrecedents

LPDISPATCH ModelCenter::IFileVariable::directPrecedents([optional]VARIANT followSuspended, [optional]VARIANT reserved)

Returns a list of variables that are immediate precedents to the value of this variable. This function returns all variables that influence this variable and are directly connected via a link to it.

Parameters:

  • followSuspended: Optional boolean specifies whether links which are suspended should be included in the search. Default is false.
  • reserved: Reserved for future use.

Returns:

IDispatch* to an IVariables object.

Parameters:

  • [optional] VARIANT followSuspended
  • [optional] VARIANT reserved

Return type: LPDISPATCH

Reimplements: directPrecedents

Function directDependents

LPDISPATCH ModelCenter::IFileVariable::directDependents([optional]VARIANT followSuspended, [optional]VARIANT reserved)

Returns a list of variables that are immediate dependents of the value of this variable. This function returns all variables that are influenced by this variable and are directly connected via a link to it.

Parameters:

  • followSuspended: Optional boolean specifies whether links which are suspended should be included in the search. Default is false.
  • reserved: Reserved for future use.

Returns:

IDispatch* to an IVariables object.

Parameters:

  • [optional] VARIANT followSuspended
  • [optional] VARIANT reserved

Return type: LPDISPATCH

Reimplements: directDependents

LPDISPATCH ModelCenter::IFileVariable::precedentLinks([optional]VARIANT reserved)

Returns a list of links that are immediate precedents to the value of this variable. All the returned links will have this variable as the LHS of the equation. Except for arrays, the returned list will be 1 element long.

Parameters:

  • reserved: Reserved for future use.

Returns:

IDispatch* to an IVariableLinks object.

Parameters:

  • [optional] VARIANT reserved

Return type: LPDISPATCH

Reimplements: precedentLinks

LPDISPATCH ModelCenter::IFileVariable::dependentLinks([optional]VARIANT reserved)

Returns a list of links that immediately depend on the value of this variable. All the returned links will have this variable as part of a RHS equation.

Parameters:

  • reserved: Reserved for future use.

Returns:

IDispatch* to an IVariableLinks object.

Parameters:

  • [optional] VARIANT reserved

Return type: LPDISPATCH

Reimplements: dependentLinks

Function precedents

LPDISPATCH ModelCenter::IFileVariable::precedents([optional]VARIANT followSuspended, [optional]VARIANT reserved)

Returns a list of variables that are precedents to the value of this variable. This function returns all variables that influence this variable, not just directly connected ones.

Parameters:

  • followSuspended: Optional boolean specifies whether links which are suspended should be included in the search. Default is false.
  • reserved: Reserved for future use.

Returns:

IDispatch* to an IVariables object.

Parameters:

  • [optional] VARIANT followSuspended
  • [optional] VARIANT reserved

Return type: LPDISPATCH

Reimplements: precedents

Function dependents

LPDISPATCH ModelCenter::IFileVariable::dependents([optional]VARIANT followSuspended, [optional]VARIANT reserved)

Returns a list of variables that are dependent upon the value of this variable. This function returns all variables that are influenced by this variable, not just directly connected ones.

Parameters:

  • followSuspended: Optional boolean specifies whether links which are suspended should be included in the search. Default is false.
  • reserved: Reserved for future use.

Returns:

IDispatch* to an IVariables object.

Parameters:

  • [optional] VARIANT followSuspended
  • [optional] VARIANT reserved

Return type: LPDISPATCH

Reimplements: dependents

Function isInputToComponent

boolean ModelCenter::IFileVariable::isInputToComponent()

Checks whether or not the variable is an input. Returns true if the variable was originally added as an input, ignoring the current state that can change based off of links.

Return values:

  • true: Input
  • false: Output

Return type: boolean

Reimplements: isInputToComponent

Function isInputToModel

boolean ModelCenter::IFileVariable::isInputToModel()

Checks whether or not the variable is an input. A linked input returns false (Output).

Return values:

  • true: Input
  • false: Output

Return type: boolean

Reimplements: isInputToModel

Function setMetadata

void ModelCenter::IFileVariable::setMetadata(BSTR name, MetadataType type, VARIANT value, MetadataAccess access, boolean archive)

Sets the meta data value of the given meta data key name.

Parameters:

  • name: Metadata specifier used to store the data.
  • type:
  • value:
  • access:
  • archive:

Parameters:

Return type: void

Reimplements: setMetadata

Function getMetadata

VARIANT ModelCenter::IFileVariable::getMetadata(BSTR name)

Gets the meta data value of the given meta data key name.

Parameters:

  • name: Metadata key name.

Returns:

Metadata value.

Parameters:

  • BSTR name

Return type: VARIANT

Reimplements: getMetadata

Function toFile

void ModelCenter::IFileVariable::toFile(BSTR fileName, [optional] VARIANT encoding)

Writes the value of the variable to a file.

Parameters:

  • fileName: Path of the file.
  • encoding: File encoding to be used (ascii, utf-8, binary).

Parameters:

  • BSTR fileName
  • [optional] VARIANT encoding

Return type: void

Function fromFile

void ModelCenter::IFileVariable::fromFile(BSTR fileName)

Sets the value of the variable from a specified file.

Parameters:

  • fileName: Path of the file.

Parameters:

  • BSTR fileName

Return type: void

Function writeFile

void ModelCenter::IFileVariable::writeFile(BSTR fileName)

Writes the value of the variable to a file.

Parameters:

  • fileName: Path of the file.

Parameters:

  • BSTR fileName

Return type: void

Function readFile

void ModelCenter::IFileVariable::readFile(BSTR fileName)

Sets the value of the variable from a specified file.

Parameters:

  • fileName: Path of the file.

Parameters:

  • BSTR fileName

Return type: void

Function toFileAbsolute

void ModelCenter::IFileVariable::toFileAbsolute(BSTR fileName, [optional] VARIANT encoding)

Writes the absolute value of the variable to a file. Optional parameter to specify the encoding as ASCII, UTF-8 or binary. If no encoding is specified, will default to ASCII for text files and binary for binary files. Will throw an exception if binary encoding is used on a text file or if ascii or utf-8 encoding is used on a binary file.

Parameters:

  • fileName: Path of the file.
  • encoding: The desired encoding of the file. Can be: 'ascii', 'utf-8', or 'binary'.

Parameters:

  • BSTR fileName
  • [optional] VARIANT encoding

Return type: void

Function writeFileAbsolute

void ModelCenter::IFileVariable::writeFileAbsolute(BSTR fileName)

Writes the absolute value of the variable to a file.

Parameters:

  • fileName: Path of the file.

Parameters:

  • BSTR fileName

Return type: void

Connect with Ansys