Is there a way to get the active workset in a document using Dynamo? I have a script that I want to run only on the elements in the active workset, so I’d like to be able to pull the workset ID and filter elements based on that. I haven’t come across any nodes that do this.
Put this in a python node, and see if it does what you need:
import clr #Import the Revit API clr.AddReference('RevitAPI') import Autodesk from Autodesk.Revit.DB import * #Import DocumentManager and TransactionManager clr.AddReference('RevitServices') import RevitServices from RevitServices.Persistence import DocumentManager from RevitServices.Transactions import TransactionManager #Reference the active Document and application doc = DocumentManager.Instance.CurrentDBDocument #Start scripting here: wt = doc.GetWorksetTable() wId = wt.GetActiveWorksetId() #Assign your output to the OUT variable. OUT = wId
Thanks a lot. That works perfectly.