Unable to set (Type) parameter value


Can someone please tell me what I am doing wrong here? I am trying to set a type parameter value but the node tells me no parameter with that name exists. However the parameter name is in the family.
image

Is the element an element type or an element instance?

The element is an element type.

You need to convert the project number output value (GetParameterValueByName) to be a string(text) for it to work. Add a string from object node between the var output (GetParameterValueByName) and value input (Element.SetParameterByName).

I tried doing that earlier. Didn’t fix the issue. Also the parameter value (project information) seems like it is a string.

What does the warning say?

operation failed. No parameter found by that name

Recreate the parameter as a shared parameter.
Remove the existing parameter in the family and replace it with the shared parameter.
Add the same shared parameter to the Revit project, make sure that both parameters are matching in values ie type/instance based, discipline, Data type, Parameter grouping.
Try it again and see how it goes.

Can you show the rest of the graph and the rest of the type properties dialog?

The parameter is already a shared parameter. Is this what you meant by putting it in to the revit project? It didn’t seem to work.

Unfortunately I might not be able to show the full graph or the rest of properties dialogue but the type parameter is located within the ‘other’ category. I turned it in to an instance parameter and it worked but when I turned it back to a type parameter the script broke again. Also the family’s are made using nested families. Does that make a difference? Sorry I can’t show much.

@shahahmad i think you are feeding an instance to the element so try node element.elementtype before feeding it to element in set parameter it’ll resolve the issue if that’s the case

Likely your element is an instance instead of a type.

I can’t really help much more without you sharing more…

I understand. The problem is the elements have family names that I can’t post. In the case the element is an instance what would you recommend I do?

Well I recommend you use instance parameters for instance info and type parameters for type info, and access setting them in the instance or type accordingly. Mixing and matching will be problematic.

Still best to post a model after scrubbing what you don’t want to post. Open a detached copy and save as a new central on your desktop. Remove everything in the mode except for six instances to reproduce the problem, purge unused 3x, delete all views except for one to recreate the problem, purge unused 3x again, and save again. Then rename the six families and post the file.

1 Like

@shahahmad

As mentioned earlier try Element.ElementType which will convert your instances into type and then feed that list for setting the parameter value.

And this is all you need in your case as you want to set the value of a parameter that is Type Parameter

So go ahead, All the very best

Regards,
BM

1 Like

Thank you Sir, That worked like a charm. Much appreciated.

1 Like