Python help for an uninitiated

Hello,

I’m using an archi-lab node called ‘Change Family Type’, and I’m getting this error “TypeError: expected BuiltInParameter, got ElementId”.

What I don’t understand is: Am I not supposed to be feeding an element ID into this? Screenshot below for context. Let me know if the .dyn file is useful (Script is messy AF).

Capture

Thanks to all who contribute in this forum, I have spent many hours learning from it!

@Lucy.SWMUDM try the following

Thank you for your response @salvatoredragotta

Error is now reading “…got UnknownElement”

Any thoughts?

@Lucy.SWMUDM Please post you dyn

Ok… here we go… below is my inherited megalodon of a .dyn… even after months of trying to understand… I can’t make heads or tails of it. Thank you greatly in advance to anyone who ventures into it.

CreateAllWindowElevations.dyn (112.2 KB)

@Lucy.SWMUDM I wasn’t expecting such a huge graph :grimacing:
what are you trying to achieve?

Yes…@salvatoredragotta it’s a monster. This script was designed to create window elevations by a previous employee.
I’ve tried to create a new one according to the BIM4Struc one but couldn’t get that to work.

Thank you heaps for looking at it.

If I am understanding the python behind the archi-lab’s node, he is using the method Element.ChangeTypeId(ElementId) which requires an ElementId. He gets that ElementId using the ElementId class constructor which requires either an integer (the literal element Id number), a BuiltInCategory, or a BuiltInParameter.

None of the versions allow for an actual element as the input (not to mention the typeIds are never even unwrapped, hence the UnknownElement error).

Basically, I think it is expecting the integer version of the element id of the type, not the type itself. The reason why your initial version wasn’t working was because the output of that custom node gives you an actual ElementId type (try verifying with the Type node).

Try using the out of the box node Element.Id with the ViewFamilyType elements as the input. Then take the int output and plug it into the typeId input of the archilab node.

2 Likes

Hi @kennyb6.
Thank you for your throughout and informative explanation. It’s making it’s way into my brain.
Also, your solution worked! huzzah!
Now… it’s for me to understand it all.

1 Like