Random Mullion selection

Hey guys,

I’m trying to make a similar facade to the one seen here

I’m currently using a few different custom mullion profiles along a tight horizontal grid on massing. I’ve never used dynamo before but is there a simple script I could use to randomise selection of the mullions on the host so that I can change their type in the drop down without having to manually select them all? Better yet would be a way to first create a completely random placement of the vertical grid members so that all of my custom mullions have a different length (at the moment I have a fixed grid and I’m just selecting 3-4 different grid segments when changing the mullion type to give the appearance of a change in length).

1 Like

Hey, thanks heaps for your help. I’m just struggling with the code block list, I can’t add a list value to my code block as it’s saying “Error: List is a class name, can’t be used as a variable.”. I’m assuming I’m going about it incorrectly though.

You can replace “list” for “lst” or “n”.
I’m working with Dynamo 1.3.2

1 Like

Generally speaking, you should never use a class name or method as a variable name because of errors like you got. Especially starting with a capital letter in a variable as basically all classes/methods start with a capital and everything is case-sensitive in coding.

The specific error you got was using the capital L in List but you should change the name to something else, like @m.rijsmus said: “lst”, etc.

1 Like


He said he never used Dynamo before :slight_smile:
Maybe this information is not gonna help him/her

You are right tho :slight_smile:

1 Like


I have the the script running, but it’s currently using all mullion types in the model. What do i need to adjust in the script to use just certain elements?

Can you post a picture of your Dynamo graph? If you are using @m.rijsmus’s, I am guessing you just need to mess with the upper portion + lacing/indexing.

Edit: Are you asking to only pick certain mullion types to change or only change to certain mullion types?

I’ve made about 3 custom mullion profiles. When I select the mass face, I want this script to help me randomise the mullions on the mass, alternating placement of any of the 3 mullion profiles I’ve made. So at the moment on my massing face, it’s only changed a few mullions but of those it’s also included the default 30mm circular profile etc.

Quick tip, when you need to take pictures of Dynamo, there is a camera at the top right. Zoom into the graph until you can read a single node clearly and click the camera, it will take a picture of the entire graph, even if you can’t see it in the view.

Also since you are editing the elements, you should change the run from Automatic to Manual (bottom left). This way you can control when the graph runs.

Now onto the mullion part. In @m.rijsmus’s graph, the top code block with the lst variable has those brackets and a number after it. That is an index, so he gets to take only the type he wants (index 6 in the list). For you, you want 3 of them so this will be slightly more complicated. I’ll try to write a quick draft to get you a list of those 3 in random order and same length as the other list in a second.

Real quick, can you look through the All Elements of Type and find the 3 mullion types you want and note the index they are in. To do this, look in the list below the node and look for the number on the left of each entry, it starts at 0 which is important.

Cheers, I really appreciate the help. This is the most thorough help i’ve ever had from a software community so I definitely appreciate it. In my current model the three I want to alternate are [0], [9], [10]

No problem! I think something like this should work. The main part is the Choose mullions rectangle:

Ignore the note below the code block, I replaced the 0, 3, 4 with the numbers you gave above.

Create the Choose mullions rectangle nodes and plug in from @m.rijsmus’s script, with the All Elements of type going into the code block and Mullion.ByElement going into the List.Count and SetParameterByName.

Ah sweet. Thanks heaps! Should this set be built upon the existing graph, or will it work alone?

It is just meant to replace the top codeblock in the original script to give you multiple mullion types randomly.

Script1 Mullion.dyn (26.2 KB)

I think this is all correct but I’m not sure how to connect the first code block. As I said I downloaded Dynamo for the first time last night so definitely a beginner! Sorry for being annoying

Ah sorry you are meant to delete the first code block and instead submit All Elements of Type straight into the second codeblock as the lst input.

Also, for the list.count at the bottom, instead of using Mullion.ByElement, use the output of List.TakeNthItem and plug that into the List.Count

Like this:


Damn, all set up but I’m getting this error

Yeah, you forgot to put a code block with “Type” as the input for parameterName. Look at the original script for it.


Lol each time is so close. The output of TakeEveryNthItem should also go into Element.SetParameterByName’s element input.