Looking for help with looping

Hey guys – I am new to working in Dynamo and am trying to write a script that will create a detail item for one-line diagram that corresponds with a panel within the existing project.

Here is what I have so far:

The top section of blocks creates a list of each panel within the project, and the bottom section pulls the detail item and creates a duplicate of a detail item with a new name.

What I need now is to create a loop so that there is a duplicate for each item in the list. As you can probably see I tried adding a python script block (I have some experience with python but am admittedly pretty rusty) – but I am not entirely sure how to make the loop execute the Family.Type.Duplicate node.

Any advice is helpful.



Is the intention to have a FamilyType for each Type Name?

If you retrieve a list of the Typenames stringtext in the upper row, you should be able to feed that list into the name input of the FamilyType.ByFamilyandName node and ‘batch create’ rather than loop to duplicate.

1 Like

Thanks for the reply Robert,

Yes that is the intention – I reopened my code and figured out that I needed to convert the Parameter “Type Name” into a string. so I made that modification.

Unfortunately when I tried plugging the list into the Family.Type.Duplicate command, it is only creating a detail out of the first item in the list when I run the script.

After run:


Apologies Robert - I reread your post and realized you recommended I use a different block instead – Here is the result:

Warning: FamilyType.ByFamilyAndName operation failed.
A FamilySymbol with the specified name, XFMR TL1A, does not exist in the Family.

Edit: I had to make sure I got the block correct

Set the FamilyType.Duplicate’s lacing to longest instead of auto, that should run through your entire list of names instead of just the first item. If that doesn’t work you could also try adjusting the @ level of the ‘name’ input.

1 Like

Thanks Hamish – changing the lacing worked perfectly!