Element.SetParameterByName operation failed. No parameter found by that name

Hello there. I am having problems with the Element.SetParameterByName because it keeps saying that there’s no parameter like the one I write in the CodeBlock but I am super sure that the parameter is there and, since I’m trying to assign a number from a range, it’s not a text type parameter.

You can use Element.Parameters to list all the existing parameters.
Is “id” a created project parameter ?

Hello Alban.
I already tried to get the parameters recalling the family type and then the family parameter but still it doesn’t find any matching name. I also tried different nodes but when it doesn’t give me the error, it doesn’t apply the change.
Anyway “id” it’s a simple parameter that I added to the family. I created both the integer version and the number.
I’m pretty sure that I’m missing something because I’m trying to adapt this script, originally used to assign an ID number to some pipes, to do the same for a group of steel profiles.

Can you turn on the node previews so we can see that’s going on in your graph?
Is “id” a type parameter or an instance parameter?

The “is” parameter is a family, type parameter. It’s an integer listed in the “Other” category.

I would like to attach it but I am a new user and I can’t upload the file.

Type parameters have to be set by the family type. It looks like you’re passing in the family instances. Family instances do not contain the type parameter definitions.

Try getting the family types instead of the family instances, or use FamilyInstance.Type to convert them.

2 Likes

Here it is!

걍 첨부터 패밀리 매개변수를 만들때, 매개변수 데이터를 유형으로 하지말고 인스턴스로 설정해야만 기본값으로 인식됨. 그리고 이런 기본값으로 지정된 매개변수만이 다이나모에서 파라미터로 가져올수 있음.