Skip to main content

Mechanical scripting interface 2025

`ObjectTags`

Last update: 16.07.2025

class Ansys.Mechanical.Application.ObjectTags

Bases: object

Defines the collection of Mechanical’s tags.

Overview

Methods

Name Description
Add Adds a new tag to the collection. Throws an error if the tag already exists in the collection.
Clear Clears the collection, removing all objects from the tags in the collection.
Contains Returns whether or not the collection contains the given tag.
GetTag Returns the tag in the collection with the given name.
IndexOf Returns the index of the given tag. If the given tag does not exist in the collection, returns -1.
Remove Removes a tag if it exists in the collection.
RemoveAt Removes the tag at the given index from the collection.

Properties

Name Description
Count The number of tags in the collection.
Item Item property.
TagNames The names of the tags in the collection.

Property detail

property ObjectTags.Count : int | None

The number of tags in the collection.

property ObjectTags.Item : Ansys.Mechanical.Application.ObjectTag | None

Item property.

property ObjectTags.TagNames : List[str] | None

The names of the tags in the collection.

Method detail

ObjectTags.Add(tag: Ansys.Mechanical.Application.ObjectTag) → None

Adds a new tag to the collection. Throws an error if the tag already exists in the collection.

ObjectTags.Clear() → None

Clears the collection, removing all objects from the tags in the collection.

ObjectTags.Contains(tag: Ansys.Mechanical.Application.ObjectTag) → bool

Returns whether or not the collection contains the given tag.

ObjectTags.GetTag(tagName: str) → Ansys.Mechanical.Application.ObjectTag

Returns the tag in the collection with the given name.

ObjectTags.IndexOf(tag: Ansys.Mechanical.Application.ObjectTag) → int

Returns the index of the given tag. If the given tag does not exist in the collection, returns -1.

ObjectTags.Remove(tag: Ansys.Mechanical.Application.ObjectTag) → bool

Removes a tag if it exists in the collection.

ObjectTags.RemoveAt(index: int) → None

Removes the tag at the given index from the collection.

Connect with Ansys