Hello,
Can someone please tell me how I can get the element ID of a shared parameter.
I have managed to find all the curtain panels in my project and isolate one, I have then been able to found all the possible paramters for that curtain panel and I have then married it up to the one I want using:
Name = param.Definition.Name
But when I try and use ElementId = param.AsElementId();
It return a value of -1 but I want the 6 digit code that usually comes.
Just param.Id should give you what you want. It will be a ElementId, but you can cast to a string if needed.
There is also a Paramter.Id node if you don’t want to do it in code.
You need the ParameterElement to get it’s ElementId:
Here’s an example:
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
#Reference the active Document and application
doc = DocumentManager.Instance.CurrentDBDocument
fec = FilteredElementCollector(doc).OfClass(ParameterElement).ToElements()
output = []
for i in fec:
name = i.Name
if "Ifc" in i.Name:
output.append([i.Id, i.Name])
OUT = output
3 Likes