Howdy all,
I’m relatively new to Dynamo and especially Python. I am trying to get a grasp on how to create a python script block that will take the currently selected element in the model and get the element ID, so I can put it through other functions (e.g., get/set parameter of element(s)). I have done some searches, and found some solutions that I have tried to replicate. However, I run into an error with the GetElementIds method, which tells me that it needs an input. Everything that I have found online, showed that there was no input necessary. Does anyone know where I might be going wrong?
import clr
import System
clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *clr.AddReference(‘RevitAPI’)
import Autodesk
from Autodesk.Revit.DB import *clr.AddReference(‘RevitAPIUI’)
from Autodesk.Revit.UI import *clr.AddReference(‘RevitNodes’)
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)clr.AddReference(‘RevitServices’)
import RevitServices
from RevitServices.Persistence import DocumentManagerimport sys
pyt_path = r’C:\Program Files (x86)\IronPython 2.7\Lib’
sys.path.append(pyt_path)doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
adoc = doc.ActiveView
uidoc = uiapp.ActiveUIDocumentsel = Selection.Selection.GetElementIds()
Any help/guidance/advice would be greatly appreciated!
Thanks!