Hi,
I m trying to get a script working that should tag all rooms on all views. below is the Dynamo and python code. Im getting an error message in line 50 expected LinkelementId got ElementId
Does anyone have a hint how to solve this?
Wouter Hilhorst

import clr
import System
clr.AddReference(“RevitAPI”)
from Autodesk.Revit.DB import *
clr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from Autodesk.Revit.DB.Architecture import *import traceback
TB =
doc = DocumentManager.Instance.CurrentDBDocument
#The inputs to this node will be stored as a list in the IN variables.
views = UnwrapElement(IN[0])
category = UnwrapElement(IN[1])
tag = UnwrapElement(IN[2])
catid = UnwrapElement(IN[3])#bic = System.Enum.ToObject(BuiltInCategory,catid)
output =
TransactionManager.Instance.EnsureInTransaction(doc)
#y=“nee”
try:
for v in views:
if not v.IsTemplate:
elementCollector = FilteredElementCollector(doc,v.Id).OfCategory(BuiltInCategory.OST_Rooms)
tagCollector = FilteredElementCollector(doc,v.Id).OfClass(SpatialElementTag)
#output.append(v.Id)
notTagged =
for e in elementCollector:
tagged = False
for t in tagCollector:
if t.Room==e:
tagged = Trueif not tagged: notTagged.append(e) for e in notTagged: doc.Create.NewRoomTag(e.Id,UV(e.Location.Point.X,e.Location.Point.Y),v.Id) t.ChangeTypeId(tag.Id) output.append(t)TransactionManager.Instance.TransactionTaskDone()
except: TB.append(traceback.format_exc())
#Assign your output to the OUT variable.
OUT = output,elementCollector,tagCollector,TB
