Randomise grids on curtain wall from list of spacing values

hi, i want randomised vertical mullions in 2 different spans, 450 and 1250, i went half way but it doesn’t work, i’d appreciate any help.
1.dyn (9.5 KB)

Something like this
I already tried this too

I even tried this but it’s only one span…

you don’t have the loop while node setup quite right. I would use a custom node for your loopbody - at least for me it is simpler to think about.

init is some value, so that looks fine, your condition looks okay, you’re going to quit when your sum of values != 1 in that list.

then your function adds a random value to that list, but it will always be the same random value as that part of your graph is not inside your function to be executed repeatedly.

Hi @arshamm,

If you are interested I showed another method to make random curtain walls at AU2017.

The video is here and the curtain wall portion is 47 minutes into the third video.


1 Like

thanks for sharing the video, but yours is changing the panel’s type.
what i want to do is to randomize the distance between mullions or the width of the panels.

Whoops! Forgot what I showed there. :blush: Let me upload a new example tomorrow morning for you. :slight_smile:

1 Like

When I do stuff like this I like to take the removal route rather than the addition route.

I start out with a curtain wall with minimum grid defined in the type properties. (in this example a 4x4)

then we remove the gridlines that we do not want, (undo to try another option) GIF below

and here is the graph image / dyn

randomCurtainGrid.dyn (14.0 KB)

Also, here is an app that does something similar if you were interested… https://apps.autodesk.com/RVT/en/Detail/Index?id=3268660468620377253&appLang=en&os=Win64


thank you John, this is a great way to randomize it.
but in my case the manufacturer gave me 4 sizes for panels, 450mm, 850mm, 1250mm and 1650mm, i want dynamo to divide the length of the curtain wall into these measurements and place a vertical grid randomly, the horizontal grid is fixed as we need only 400mm for dust space. something like this that I’ve been doing manually;
do you think if it’s possible?

There might be a more elegant solution than this but it seems to do the trick…

Python script:

import clr
from Autodesk.DesignScript.Geometry import *

import sys
#The inputs to this node will be stored as a list in the IN variables.
pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
import random

#The inputs to this node will be stored as a list in the IN variables.
vals = IN[0]
length = IN[1]
refresh = IN[2]

def addVals(nums,total):
	sum = 0
	vals = []
	i = 0
	while sum<=total:
		i = random.choice(nums)
	return vals

OUT = addVals(vals,length)

Code Block:

vals = DSCore.List.RemoveItemAtIndex(list, (Count(list)-1));
amount = DSCore.List.Count(vals);
seq = 1..#amount..1;
spaces = Math.Sum(DSCore.List.TakeItems(vals,seq));
params = spaces/length;
points = (curtWall.GetLocation()).PointAtParameter(params);

EDIT to add, I’d freeze the CurtainGrid.AddGridLineByPoint node and run a few times refreshing, until I see a combination of points I like. And follow this suggestion from the post you linked above:


I added a bit to visualize the panels to better find a preferable confugration before running the graph (with the CurtainGrid.AddGridLineByPoint node unfrozen):

Add Curtain Grids at Random Vals from List.dyn (18.3 KB)

Hope this works for you :slight_smile: I’m thinking there could be a more effective/concise solution than this, so maybe someone else might share some ideas


you are the best! thank you Amy…

1 Like

Thanks a lot for your script.
How about controling horizontal grids? I’ve already tried “unconnected height” and tick true for “isUGridline” but it seem not working…

@NguyenTriTrung you’d have to adjust the code block where it says:

points = (curtWall.GetLocation()).PointAtParameter(params);

This part is creating points along the location line where grids will be placed. I can’t test at the moment but try modifying that line of the code block to get the start point of the curtain wall location line, and then translating another point in the z direction by the unconnected height parameter value. Then create a line using those two points as the start and end point, and from that line get the grid location points with PointAtParameter(params)

Let me know if you need clarification


I’ve already tried your code either but it still not working. I always get problems with “Unconnected Height” parameter when I want to get the element’s height. In the code block, I saw “params = spaces/length;”. Does it affect the result also?

Please help me clarify whenever you have time. Thanks a lot for your enthusiastic.

@NguyenTriTrung The params = spaces/length should still work with a height value, but if I am understanding correctly it sounds as though you are having trouble getting the height. Perhaps you should create a new topic and upload images with where it is failing, and the error you are getting.

1 Like

This is the topic i’ve just created. Please notice if u have any interest. Thank you :smiley:
Randomise horizontal grids on curtain wall - Getting height value

how do i get this to apply to my revit curtain wall? (delete the curtain grid portions) i am very green to dynamo. i see the preview in dynamo but, nothing gets selected in revit… apologies up front if this is a silly question…

1 Like