Hi,
i’m trying to sort tag based on the fact that they are tagging a linked element.
I can get all the tags of course but looking for a way to sort linked host or not
Hi Daniel,
To obtain the the tagged dElement there is the Tag TaggedElement node in Genius Loci package.
But knowing the linked host could be more difficult.
Hi
here an example
import clr
import sys
import System
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import Autodesk.DesignScript.Geometry as DS
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)
def IsLinkTag(t):
if isinstance(t, SpatialElementTag):
return t.IsTaggingLink
else:
localElem = doc.GetElement(t.TaggedLocalElementId)
locallnkElem = doc.GetElement(t.TaggedElementId.LinkInstanceId )
return localElem is None and isinstance(locallnkElem, RevitLinkInstance)
wrappers = clr.GetClrType(Revit.Elements.ElementWrapper).GetMethods()
for w in wrappers:
if w.ToString().startswith("Revit.Elements.UnknownElement"):
ueWrapper = w
break
toList = lambda x : x if hasattr(x, '__iter__') else [x]
lstTags = toList(UnwrapElement(IN[0]))
localTagElem = [ueWrapper.Invoke(None, (t, False)) for t in lstTags if not IsLinkTag(t)]
linkTagLinkElem = [ueWrapper.Invoke(None, (t, False)) for t in lstTags if IsLinkTag(t)]
OUT = localTagElem, linkTagLinkElem
3 Likes
This works for independant tag but Is TaggingLink seems to be appropriate for spatial element tag no?
yes, i edit my previous post with this case
deee… needed a flatten list ahahahah
brilliant, thanks a lot
1 Like