Using APIs, you can access Mechanical tree objects. The object representing the project node
of the tree is DataModel.Project
.
Each object can have children that you access by using the property
Children
. For example, assume that the
Outline view in Mechanical looks like this:
To return all objects directly under the Project node, you enter this:
DataModel.Project.Children
Under the Project node is the Model node. Some examples follow for accessing Model child nodes:
Mesh = Model.Mesh
Connections = Model.Children[3]
To access all objects with a given name, you use the method
GetObjectsByName
:
DataModel.GetObjectsByName("name
")
To access all objects if a given type, you use the method
GetObjectsByType
and pass the data model object category (such as
DataModelObjectCategory.Force
) as an argument:
DataModel.GetObjectsByType(DataModelObjectCategory.Force)