Hi, I’d like to retieve which Project Location is active on my Revit Model though Dynamo
1 Like
Hello
try this python code:
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
# Import DocumentManager and TransactionManager
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
# Import RevitAPI
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
items = UnwrapElement(IN[0])
elementlist = list()
b = doc.ActiveProjectLocation.Id
for item in items:
try:
if item.Id == b:
elementlist.append(True)
else:
elementlist.append(False)
except:
elementlist.append(False)
OUT = elementlist
1 Like
Thanks!