Custom wait code block not working

Hi all,

I have been trying to create a script to change a family to another and then transfer some of its parameters so I have a head start when coordinating model. Although, after hours of searching and trial and error I have not been able to get it to work. I have seen many posts where a “wait” or a “passthrough” node is needed so the script does not try to get the parameters from the second family when trying to insert the new parameter but as I have not found the nodes “wait” nor the “passthrough” in packages such as Clockwork, Genius Loci, Rhythm, Springs, etc. then I have decided to write a code block node with “out = [wait, pass]; out[1];” as shown in many post.

Unfortunately, I’m not very good when it come to coding. could someone help me get this script working? As the parameters from “FireProtection_Beam_3_Sided: 35mm_Firecase(35)” are currently not getting transferred to my “INT_BeamProtection_Beam_3_Sided:15mm Fireline”

ChangeFamilyThenTransferParameter.dyn (35.8 KB)

It’s hard to tell where any of the pass inputs are coming from, but it looks like you’re not using the passthrough logic correctly. Dynamo executes nodes when there is a change to the inputs. This means that a graph typically gets executed from left to right, from node to node, as the inputs change. A passthrough or wait node is just a node that’s meant to pause the delivery of an input (pass) until another action has completed (wait).

You seem to have your passthrough nodes setup with the wait input being the object you want to pass on, which is incorrect. The wait input needs to be the final output of whatever function you want completed before moving on in your graph. The pass input is just the value that is being passed on to the next portion of your graph.

You also have all your passthrough nodes connected with the wrong output. You’re passing on the list instead of the value in the second line.

Alos, because you’re making a change to the family type before updating values, you actually have to use separate transactions here. Dynamo nodes update individually, but the changes get pushed to Revit in a single transaction. This would mean that the family change and parameter values would happen at the same time, which Revit can’t do. You need to use a Transaction node after changing the family type (and before setting the parameter values) so that Revit has already updated the family type when it tries to write to the new parameters.

Try fixing all these things and see where you get. We’ll be able to help you out more when you have the general logic better laid out.

Hi @Nick_Boyts,

Thanks for the prompt response. I have swap the passthrough nodes but it has not worked.
I have also added transaction nodes after the family has been changed but the only the length seem to be transferred.

Any ideas on what I have done wrong?

Make sure you’re always posting screenshots with the node preview bubbles pinned so we can see what’s going on. Without them, we’re just blind guessing.

Can you get the correct element parameters (but with the old values still)? We don’t know if it’s an issue with the parameters themselves or changing their values. It looks like you use All Elements of Family and FamilyInstance.ByFamilyType - are those returning two different lists?

1 Like

Hi @Nick_Boyts,

Attached the results with all pinned bubbles.

The script is changing the family but not inputting the parameters results as it has an error on the set parameter by name where all of them say the same.
“Warning: Element.SetPaarameterByName operation failed. The parameter’s storage type is not a string”

I have tried to place a “String from object” between the code block and the value to be set and between the elements and the set parameter in the hopes that that would sort the issue but the attempts where unsuccessful so I have removed all “string from object” nodes.

But have not got any idea what string is the “Element.SetByParameterName” node expecting.

Appreciate your time and help.

Hi @JocoYo, maybe you need to use String.ToNumber where you placed the string from the object.
If you haven’t achieved the desired outcome, you should check the storage type of parameters and feed them accordingly.

2 Likes

What @sjafarali75 said. The error says the storage type is not a string. You’re providing a string but the parameter expects a number.

When you initially try to get the parameter values they come back blank. This is an empty string and not the same as 0. When you add a number to a string it concatenates.

1 Like

@sjafarali75 @Nick_Boyts,
Thank you very much for the help guys. Would not have been able to get it working without your help.
The script is now working correctly.


ChangeFamilyThenTransferParameter.dyn (48.4 KB)