Random distribution of an object onto a surface

Hi Everyone,

I would like to reproduce the effect of the image below in Revit using Dynamo.

The intent is to randomize the distribution of the pendant on a rectangular surface. Random distribution of a family onto a surface.rvt (2.8 MB)

I am quite sure it is possible to do it in Dynamo but I am quite new to this tool so I need your precious help :slight_smile:

Thank you very much in advance.



That’s a pretty straight-forward task. There’s many more examples of this if you search through the forum:

All you really need to do is feed in a surface, generate some random parameters and finally use those parameters on the surface. It all boils down to just three lines:

u = Math.RandomList(n);
v = Math.RandomList(n);
pts = sf1.PointAtParameter(u,v);


Thank you very much for your great help :slight_smile:

This is the outcome obtained in Revit after tweaking a little bit your script:

Is there a way to remove family instances intersecting with each other?

Thank you in advance.


Now, that’s a more interesting challenge. You could try to create the circles/instances first, then check for intersections and filter/delete the offenders but that would be too cumbersome. Instead I’d suggest you try to group the random points by their rough location. To do that, you can round up the points with The Clockwork package’s “Point.RoundUpToPrecision” node, group the random points by the rounded points and select only one of the points in each new group. See how in the below example the majority of the groups have just one element, but some have 2/3. Those are the ones that are going to get intersected:

You’ll need to play with the precision a bit. I think that a precision of 3 times the radius should suffice.