Skip to main content

Mechanical scripting interface 2025

`Tree`

Last update: 16.07.2025

class Ansys.ACT.Automation.Mechanical.Tree

Bases: object

Overview

Methods

Name Description
Activate selects an object in the tree.
ClearFilter Clears the current filter.
ClearSort Clears the current sort.
Filter Filter method.
Find Find method.
GetPathToFirstActiveObject Gets the full path that needs to be typed in order to go to the selected object.
Group Groups a list of objects together.
IsSorted Checks if the tree is currently sorted alphabetically.
Refresh Refreshes the tree.
Sort Sorts the tree objects based on given parameters.
Suspend Prevents the tree from being updated.
Ungroup Removes groupingFolder from the tree.

Properties

Name Description
ActiveObjects Gets a list of all selected objects.
AllObjects Gets a list of all objects available in the tree.
CurrentFilter Gets the current filter applied on the tree.
CurrentSearchGraphics Gets the current visibility.
CurrentSearchState Gets the current search state.
CurrentSearchString Gets the current search string (name/tag/propertyName/propertyValue).
FirstActiveObject Gets the first object selected in the tree.
GroupingFoldersVisible Controls whether or not group folders are visible.

Property detail

property Tree.ActiveObjects : List[Ansys.Mechanical.DataModel.Interfaces.IDataModelObject] | None

Gets a list of all selected objects.

property Tree.AllObjects : List[Ansys.Mechanical.DataModel.Interfaces.IDataModelObject] | None

Gets a list of all objects available in the tree.

property Tree.CurrentFilter : Ansys.Common.Interop.DSObjectTypes.DSTreeSearchType | None

Gets the current filter applied on the tree.

property Tree.CurrentSearchGraphics : Ansys.Mechanical.DataModel.Enums.VisibilityType | None

Gets the current visibility.

property Tree.CurrentSearchState : Ansys.Mechanical.DataModel.Enums.ObjectState | None

Gets the current search state.

property Tree.CurrentSearchString : str | None

Gets the current search string (name/tag/propertyName/propertyValue).

property Tree.FirstActiveObject : Ansys.Mechanical.DataModel.Interfaces.IDataModelObject | None

Gets the first object selected in the tree.

property Tree.GroupingFoldersVisible : bool | None

Controls whether or not group folders are visible.

Method detail

Tree.Activate(dataModelObject: Ansys.Mechanical.DataModel.Interfaces.IDataModelObject) → None

selects an object in the tree.

Tree.ClearFilter() → None

Clears the current filter.

Tree.ClearSort() → None

Clears the current sort.

Tree.Filter(name: str, tag: str, state: Ansys.Mechanical.DataModel.Enums.ObjectState, visibility: Ansys.Mechanical.DataModel.Enums.VisibilityType, type: Ansys.Mechanical.DataModel.Enums.TreeFilterObjectClass, coordinateSystem: Ansys.ACT.Automation.Mechanical.CoordinateSystem, model: str, environment: Ansys.ACT.Automation.Mechanical.Analysis, scoping: Ansys.Mechanical.DataModel.Enums.TreeFilterScopingType, filterState: Ansys.Mechanical.DataModel.Enums.TreeFilterObjectState, propertyName: str, propertyValue: str, invertSearchResults: System.Nullable[bool]) → None

Filter method.

Tree.Find(name: str, func: System.Func[Ansys.Mechanical.DataModel.Interfaces.IDataModelObject, bool], tag: str, state: Ansys.Mechanical.DataModel.Enums.ObjectState) → Iterable[Ansys.Mechanical.DataModel.Interfaces.IDataModelObject]

Find method.

Tree.GetPathToFirstActiveObject() → str

Gets the full path that needs to be typed in order to go to the selected object.

Tree.Group(dataModelObjects: Iterable) → Ansys.ACT.Automation.Mechanical.TreeGroupingFolder

Groups a list of objects together.

Tree.IsSorted() → bool

Checks if the tree is currently sorted alphabetically.

Tree.Refresh(recomputeStates: bool) → None

Refreshes the tree.

Tree.Sort(type: Ansys.Mechanical.DataModel.Enums.SortingType, reverse: bool) → None

Sorts the tree objects based on given parameters.
type
reverse

Tree.Suspend() → System.IDisposable

Prevents the tree from being updated.

Tree.Ungroup(groupingFolder: Ansys.ACT.Automation.Mechanical.TreeGroupingFolder) → None

Removes groupingFolder from the tree.

Connect with Ansys