# Creating random louvre pattern for trellis design

Hello I’m working on a trellis design and would like to have some random louvre pattern on each side for sun shading. The ultimate goal of this script is to provide a more convenient way for architects to design a trellis based on the sun factor at each construction site (hopefully using the generative design function in dynamo). Below are the design limitations:

1/ Random pattern similar to this photo:

2/ Length of all louvres is set to be 5 adjustable numbers only (e.g. 1000/ 1500/ 2000/ 2500/ 3000mm)

3/ No louvres are allowed to exceed a designated rectangular boundary (correlates to the height and width of trellis; please feel free to set your own parameters for the trellis)

4/ Length/position of louvres correlates to the sun position or attractor system that resembles the position of sun (i.e. denser louvres at places where insolation is the highest to shade the sun; and vice versa to provide space for ventilation)

5/ All louvres sharing the same height and thickness that’re adjustable by users.

6/ No overlapping of louvres is allowed.

I’ve tried writing a script with dynamo 2.6.1 and here’s my logic:

1. Select the edges of trellis’ ceiling and floor to create a rectangular boundary.
(Every time I’ll simply open a new revit file and draw two floor slabs at Level 1 and 2 respectively for selection)
2. Creating a surface based on the boundary and adding some random points on it.
1. Generating louvres with a cuboid node that uses the random points as origin.
2. Creating an attractor system that helps to adjust the length of louvres according to a proposed sun location.
1. Regenerating a new list of louvre lengths with five adjustable numbers only. (e.g. set all values below 2000mm to 2000mm; while those between 2000-2500mm to 2500mm and so on)
1. Trimming the louvre extents that exceed the boundary.

However, the problems of louvres overlapping each other / the actual louvre length after trimming violates the “5 number rule” still exist and I’ve got no ideas on how to fix it. I’m a newbie to dynamo and have zero experience in dealing with python. A direct modification to my existing script/ creation of new dynamo script is greatly appreciated. Thank you so much !!

(I’m sorry that the Forum restricts me from uploading the script here, and every post can only hold one photo, so I have to do the screenshots bit by bit… just feel free to ask for details or additional screenshots )

1 Like

Instead of using random points, try:

• Building isolines on the face. Build a constrained consistent spacing based on the height of the louver.

• Once you have those, use a seeded shuffle node to re-sort the results into a more random distribution. Be sure to keep the seed as an input as a number slider.

• Then take the first N curves out of the list using a List.TakeItems node. Make sure your N value is another input as a number slider.

• Next use a Math.RandomList node to create parameter values which will serve as the basis of the louver.

• Split the remaining isocurves at this location, reverse the first curve in each sublist. Then shuffle the sublists with another seeded shuffle node.

• Assign a value from your lists of lengths to each, and get the length of each curve in the sublists. Divide that by the associated louver length. That value will be the trim parameter.

• If the value is >1 then discard both the value and the line in the associated sublist.

• Take the first line in each sublist and trim it by the associated parameter.

• The trimmed line can now host a sweep for your Generative Design/Dynamo display, and serve as a location curve for the louver family in Revit.

The Math.RandomList might not be repeatable for Generative Design as the second run (to create the Revit Elements) could give different results. If so replace it by building a LONG list of values yourself and using another seeded shuffle value to produce a repeatable result.