- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a little plugin that goes through and automatically tags all the doors in a view. Because of the complexity of the doors this important because only certain families in the door category should be tagged. This is to make it easier for users.
With 2022 and higher, the property of IndependentTag class has been removed and I'm unable to a simple check as I did before. Here's a copy of my previous code:
using (Transaction trans = new Transaction(doc, "Tag Parent Doors"))
{
trans.Start();
foreach (FamilyInstance door in doors)
{
if (new FilteredElementCollector(doc, currentView.Id) //this collector checks if there is a tag associated with the door
.OfCategory(BuiltInCategory.OST_DoorTags)
.OfClass(typeof(IndependentTag))
.Cast<IndependentTag>()
.Where(q => q.TaggedLocalElementId == door.Id).Any())
{
skipCount++;
continue; /The problem is on line 10. TaggedLocalElementId is not a property of IndependentTag anymore.
I know this is likely basic to many of you but how would I alter the existing collector to instead use GetTaggedLocalElement() and skip items that contain door.Id within this collector? Or is there a different strategy completely I should look at?
I understand that the results from the new method will be a list, but I still should be able to verify that the specific door.Id isn't in that list. Perhaps there is a way know that the "door" has an associated tag?
Thanks in advance,
Tom
Solved! Go to Solution.