Skip to main content

Mechanical scripting interface

ObjectTags

Last update: 14.01.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)

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

ObjectTags.Clear()

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

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

Returns whether or not the collection contains the given tag.

ObjectTags.GetTag(tagName: str)

Returns the tag in the collection with the given name.

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

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)

Removes a tag if it exists in the collection.

ObjectTags.RemoveAt(index: int)

Removes the tag at the given index from the collection.