How to create a Do While Loop to process Family Parameters in Revit

I’m new to the nuances of Dynamo, and I can see similar questions has been asked before, but after searching for a suitable answer I find am struggling to find it, either only part of the question is posed or only half the solution is answered.
Dynamo offers tremendous benefit to designers (who are not necessarily programmers) but know what they want to do in Revit, and find a programming tool like Dynamo sometimes very frustrating. This type of programming (visual programming) should be very intuitive and child’s play to produce elegant solutions, but to create one of the most basic programming conditions, a “Do While Loop” I am still struggling to find a good simple example.
If you look at Revit, it is a parametric design tool, which utilizes parametric families that are placed in a virtual (design) model to aid the decisions that create something real in the real world. The key here is “parametric design”, which allows (or should allow) easy manipulation of “parameters” to influence the final design.
Therefore you need good toolsets that allow you the flexibility to change the parameters of family objects, not just at an one instance but, also at multiple iterations of that instance, and potentially with differing parametric values for that instance, and this requires a “loop” process in the programming to achieve, but I don’t seem to easily find a good example, and the fact the question has been asked on more than one occasion, suggests something is lacking in this area.
I would like to put forward anIsList.dyf (5.5 KB)

CUBE-D.dyn (125.5 KB)
Cubed.rvt (1.2 MB)
example of where I have got to in the process, however in the example I’m not sure of how to implement a “Do While” condition to sort through the main process, multiple times. Hopefully someone more enlightened can help ?
Cubed is a Revit file containing a “Cube” family which has parameters “a, b and c” which are the cube’s width, depth and height. The dynamo file is Cube-d.dyn which contains a nested “node” called IsList.dyf. (The .PNG files illustrate my challenge, all files are from Revit 2016).
The Dynamo file allows you to access and change the parameters a, b & c. There probably are a myriad of ways to change these parameters, but I wanted to see what and how it could be done using Dynamo.
Thanks Roland.

I could be reading wrong but is all you want to do is run your graph on each cube element? Depending on what version of Dynamo you’re using you can plug your whole element list into the element input of element.setparameter. If you have a list of values, the same length as the list of elements, for a, b and c then Dyanmo will iterate over your list of elements applying the list of parameters (a,b and c) for you. If your list lengths are different (for a reason) you’ll have to look at the lacing.

Sorry if I completely missed the mark on what you were looking for.

Could you do something like this?

Thank you to both Jimmy and Einar for your replies.

I assume Jimmy, what you are saying, is what Einar has put forward ?

My original intention was to look at how a “generic” Revit family’s parameters could be manipulated, the cube is immaterial, it could have been some furniture or any other family, I would like to control other parameters of the family, importantly it’s position, but I guess that will be an addition to this exercise.

However I have recreated the code and have attached the files for discussion. It certainly is a more elegant solution ! But it is not without some issues which I guess will require some additional code to fix.

First of all I’ll start with a Revit file that has the same number of placed families, as there are listed in my Code Block ie (4). When I run the code it creates an additional family on the original pt.

Secondly when I run the code again it comes up with some sort of reversal of the list which at this stage makes no sense. When I re-run the code again, it switches back to the set out dimensions.

So it kind of works, I assume if you wanted to process 400 families rather than 4, you would have a link to a list such as a list in excel, I haven’t looked at interfacing a list from excel at this point.

The version of Dynamo I’m using is

New Dynamo Code, CUBE6D.dyn (86.9 KB)

Revit File, Cube6D.rvt (1.2 MB)

Additional family added at origin point.

Results from running the Dynamo code on alternate Occasions ;

Thank you Jimmy, see my reply to Einar, below.

Hi Roland,

You need to change “Lacing to Longest” at “Element.SetParameterByName” node.

Thank-you Kulkul,

However making your suggested change did not seem to improve the outcome, the same problem existed when re-running the Dynamo code, ie the a, b, and c output values get screwed up every alternate run.

What is your end goal can you show us screenshot how it looks like?

@RLietz I downloaded your last .dyn and it looks like you forgot to delete your old stuff:


My apologies to Kulkul.

Elinar is correct, I was untidy in not deleting my old code floating around, now it is working perfectly, this is a neat way to manipulate family parameters.

Your solution has given me a good simple example to control family parameters in Revit with Dynamo. The final Revit file and Dynamo are attached.

Thank-you to Jimmy, Einar and Kulkul.

CUBE_D.dyn (5.4 KB)
Cube_D.rvt (1.3 MB)

What I learnt here, I then applied it to the next step, of controlling a Revit family via an Excel input