Get Element Id, some syntax-problems, why?

Hello,

I stuck, i want just get RevitID via scripting:

elemIds = []

for id in IN[0]:
    elemIds.append(ElementId(id))


#Assign your output to the OUT variable.
OUT = elemIds

2020-09-03_15h30_47
2020-09-03_15h50_25

need i an object Type?

KR

Andreas

Something like this?
image

elemIds = []

for id in IN[0]:
	elemIds.append(id.Id)
	
OUT = elemIds
1 Like

Thank you!

So you can dotting in brakets also… Can i see it like this: …x.append(i.anyproperties)
can i query BuildInParameters?

Is my code from C# … i got it from anywhere?

I’m not the best person to comment on that since I’m also starting out with API.
But, yes, I believe you should be able to access the element property using that (as long as it exists for that type of element). Also, you need to unwrap the element to access the properties…

elementCategory = []


for elem in UnwrapElement(IN[0]):
	elementCategory.append(elem.Category.Name)
	
OUT = elementCategory

And no, ElementId(id) is not something C# specific, it’s a Constructor


It is not supposed to return the Element’s ID!

1 Like