Copy Values from a Single Project Parameter to Another

I have a Project Parameter assigned to the Doors Category called COBie.Type.Name. It is a Type parameter and is Text. Most of the families in this category have a unique value manually populated for this parameter, some may be blank. I have created another Project Parameter called Type.Name, also a Type parameter, also Text, and also assigned to the Doors category. There are a total of 39 Types within this category.

I would like to create a script to simply copy the values found in COBie.Type.Name into Type.Name for the respective Type, even if it is found to be blank.

My thought process was to collect all elements of the target category and then get the specific source parameter by name and use Element.SetParameterByName to copy the values into the target parameter. Unfortunately Element.SetParameterByName returns “No Parameter found by that Name”.

I set watches on the the 2 major collectors and it looked like Element.GetParameterValueByName (Rhythm package?) was returning a broken list (although a correct count). However when I disconnect it and use a code block to insert a “Test” value for all entries I get the same error which suggests the problem might be with the AllElementsByCategory function.

Any help is appreciated

Hi @jtaylor,

Does it help when you place an “element.type” node between “All Elements of Category” and “Element.SetParameterByName” nodes ?

Kind regards,
Mark

Same error but with more verbose watch listing:

FWIW, I get the exact same output if I opt to go by Family Type. That is somewhat encouraging because I’d rather address the Category as a whole rather than all 39 different Families. I do feel like there’s something missing before Element.SetParamaterByName at the element node but I have no idea what.

Is your new parameter called TypeName or Type.Name ?

It is called TypeName at this point. It was Type.Name previously. I wish it was that easy.

I found the issue (though not the solution). If I attach a Element.Parameters node to the output of All Elements of Category I find that i am only outputting instance parameters instead of type parameters. I have no interest in the instance parameters, I am specifically wanting to access type parameters.

Then you either need to use one of the nodes that works for both instance and type parameters or get the family type and set the parameter for the family type. I prefer setting the parameter for the type.

Nick, I understand (mostly) what you are saying but can you be more specific? I was trying nodes that were specific to family types but still ultimately resolving to instance parameters. My goal is, as you say, to set the parameter for the type but I am a rank novice and have no clue which particular node performs that function and my searching has failed me.

You don’t need the All Elements of Family Type node. If both parameters are type parameters you can get/set them directly from Family Type element.

@jtaylor

You might be better of with naming your parameter in a different way.
Type.Name of TypeName could leed to confusion.
Why not call it TypeName_1?

Marcel

This worked for me.


view2

1 Like

Okay, Benjamin, it worked for me as well when I swapped out my SetParameterByName node with the Type or Instance version you showed from the Rhythm package. thanks to everyone. It is nice to know my original premise wasn’t too far off I was just using the wrong node type.

I can’t mark more than one post as solved. The original suggestion to use the Element.Type node was good as well.