Getting the default (selected) annotation tag using the code

Getting the default (selected) annotation tag using the code

aboriakin
Explorer Explorer
284 Views
1 Reply
Message 1 of 2

Getting the default (selected) annotation tag using the code

aboriakin
Explorer
Explorer

Hi all,

Is it possible to get (via code) the default (selected) tag for a specific category?
I can get a list of possible annotation tags for the selected element, but I can't determine which one is the default.

For ex.
Doors have 4 possible tags. Tag 3 is the default (selected). Is there any way (using code) to determine which of the 4 tags is the default for a particular category?

Untitled.png

0 Likes
Accepted solutions (1)
285 Views
1 Reply
Reply (1)
Message 2 of 2

studio-a-int
Advocate
Advocate
Accepted solution

Yes, it is possible.

For Door Tags use:

 

ElementId defaultDoorTagTypeId = yourActiveDocument.GetDefaultFamilyTypeId(new ElementId(BuiltInCategory.OST_DoorTags));

 

You will get the Id of your active Door Tag, and you can pass that in your methods.

 

For other Tag Categories, use the specific Tag Category, IE:  OST_RoomTags, OST_PipeTags, etc.