IWorkflow#

class IWorkflow#

Bases: ansys.engineeringworkflow.api.IWorkflowInstance, abc.ABC

Represents a ModelCenter workflow.

Overview#

set_value

Set the value of a datapin.

get_datapin_state

Get the state of a datapin.

get_datapin_meta_data

Get the metadata from a datapin.

create_link

Create a link to a given datapin based on a given equation.

save_workflow

Save the workflow.

save_workflow_as

Save the workflow to a file.

close_workflow

Close the workflow.

get_datapin

Get a datapin with a given name.

get_component

Get a component from the workflow.

remove_component

Remove a component from the workflow.

create_assembly

Create an assembly in the workflow.

auto_link

Automatically link two components.

get_links

Get a list of all links in the workflow.

get_workflow_uuid

Get the unique ID for the workflow.

halt

Stop execution of the workflow in ModelCenter.

move_component

Move a component to the parent at the given index.

get_assembly

Get the named assembly or the top-level assembly.

create_component

Create a component.

workflow_file_name

Full path of the workflow.

Import detail#

from ansys.modelcenter.workflow.api.iworkflow import IWorkflow

Property detail#

property IWorkflow.workflow_file_name: str#
Abstractmethod:

Full path of the workflow.

Method detail#

abstract IWorkflow.set_value(var_name: str, value: ansys.tools.variableinterop.IVariableValue) None#

Set the value of a datapin.

Parameters:
var_namestr

Full ModelCenter path of the datapin.

valueatvi.IVariableValue

New value to set.

Raises:
InvalidInstanceError

If a datapin with the given name does not exist.

abstract IWorkflow.get_datapin_state(var_name: str) ansys.tools.variableinterop.VariableState#

Get the state of a datapin.

Parameters:
var_namestr

Full ModelCenter path of the datapin.

Returns:
VariableState

Value as a VariableState.

Raises:
InvalidInstanceError

If a datapin with the given name does not exist.

abstract IWorkflow.get_datapin_meta_data(name: str) ansys.tools.variableinterop.CommonVariableMetadata#

Get the metadata from a datapin.

Parameters:
namestr

Full name of the datapin.

Returns:
atvi.CommonVariableMetadata

Metadata of the datapin.

Raises:
InvalidInstanceError

If a datapin with the given name does not exist.

Create a link to a given datapin based on a given equation.

Parameters:
datapinUnion[IDatapin, str]

Datapin that the link should target or its full name.

equationUnion[str, IDatapin]

Equation of the link. You can also pass an IDatapin object here, and its name becomes the equation.

Raises:
InvalidInstanceError

If either the target or equation datapin does not exist.

abstract IWorkflow.save_workflow() None#

Save the workflow.

abstract IWorkflow.save_workflow_as(file_name: str) None#

Save the workflow to a file.

Parameters:
file_namestr

Path to save the workflow in.

abstract IWorkflow.close_workflow() None#

Close the workflow.

abstract IWorkflow.get_datapin(name: str) ansys.modelcenter.workflow.api.idatapin.IDatapin#

Get a datapin with a given name.

Parameters:
namestr

Full ModelCenter path of the datapin.

Returns:
IDatapin

Datapin with the given name.

Raises:
InvalidInstanceError

If a datapin with the given name does not exist.

abstract IWorkflow.get_component(name: str) ansys.modelcenter.workflow.api.icomponent.IComponent#

Get a component from the workflow.

Parameters:
namestr

Full path and file name to the component.

Returns:
IComponent

Component with the given name.

Raises:
InvalidInstanceError

If a component with the given name does not exist.

abstract IWorkflow.remove_component(name: str) None#

Remove a component from the workflow.

Parameters:
namestr

Full ModelCenter path of the component.

Raises:
InvalidInstanceError

If a component with the given name does not exist.

abstract IWorkflow.create_assembly(name: str, parent: ansys.modelcenter.workflow.api.iassembly.IAssembly | str, assembly_type: ansys.modelcenter.workflow.api.iassembly.AssemblyType | None = None) ansys.modelcenter.workflow.api.iassembly.IAssembly#

Create an assembly in the workflow.

Parameters:
namestr

Name of the new assembly.

parentUnion[IAssembly, str]

Full ModelCenter path of the parent IAssembly object or an IAssembly object that represents it.

assembly_typeAssemblyType, optional

Type of the assembly to create. Pass None to create a regular data-dependency assembly. (This is equivalent to passing AssemblyType.ASSEMBLY.)

Returns:
IAssembly

Created assembly.

Automatically link two components.

Parameters:
src_compstr

Source component or the full name of the component desired.

dest_compstr

Destination component or the full name of the component desired.

Returns:
Collection[IDatapinLink]

Collection of the created links.

Raises:
InvalidInstanceError

If either the source or destination component does not exist.

Get a list of all links in the workflow.

Returns:
Collection[IDatapinLink]

Iterable over datapin links.

abstract IWorkflow.get_workflow_uuid() str#

Get the unique ID for the workflow.

abstract IWorkflow.halt() None#

Stop execution of the workflow in ModelCenter.

abstract IWorkflow.move_component(component: ansys.modelcenter.workflow.api.icomponent.IComponent | str, parent: ansys.engineeringworkflow.api.IControlStatement | str, index: int = -1) None#

Move a component to the parent at the given index.

Parameters:
componentUnion[IComponent, str]

Component to move.

parentstr

Owning object of the component.

indexint, optional

Position in the parent.

Raises:
InvalidInstanceError

If the target component does not exist.

abstract IWorkflow.get_assembly(name: str | None = None) ansys.modelcenter.workflow.api.iassembly.IAssembly#

Get the named assembly or the top-level assembly.

Parameters:
namestr, optional

Full name of the desired assembly. If None is passed, the root assembly of the workflow is returned.

Raises:
InvalidInstanceError

If an assembly with the given name does not exist.

abstract IWorkflow.create_component(server_path: str, name: str, parent: ansys.engineeringworkflow.api.IControlStatement | str, *, init_string: str | None = None, av_position: Tuple[int, int] | None = None, insert_before: ansys.modelcenter.workflow.api.icomponent.IComponent | ansys.modelcenter.workflow.api.iassembly.IAssembly | str | None = None) ansys.modelcenter.workflow.api.icomponent.IComponent#

Create a component.

Parameters:
server_pathstr

Source path of the new component, such as the URL to the component in ModelCenter Remote Execution.

namestr

Name of the new component.

parentUnion[aew_api.IControlStatement, str]

Parent assembly of the component.

init_string: str, optional

Initialization string.

av_position: Tuple[int, int], optional

Position in the analysis view to insert the component at.

insert_before: Union[IComponent, IAssembly, str], optional

Component before where this component is to be inserted.

Returns
——-
IComponent

Created component.