Placing equipment with Generative Design

Hi guys

Some weeks ago I developed a program that can create a working space in front of every piece of equipment for a small electric module. Following @jacob.small advise I am willing to go to the next level and create a program that arranges all the piece of equipment inside of the specific module trying to follow some parameters:

:black_small_square:︎Equipment and working spaces mustn’t overlap (as little as possible)
:black_small_square:︎Equipment needs to face to the center of the room (parallel to its closest wall)
:black_small_square:︎All equipment must be close to the walls of the module to allow a good evacuation route.
:black_small_square:︎Some pieces of equipment works better if they’re close to each other, for example a baterry and an ups.

That will be a good start and then the program could grow better with other parameters, I have never used generative design so I would thank a bit advise for this.

Here you have an example of how a module looks (blue and red zones are working spaces).

Thank you!

There are a few ways to do this, but I’ll share my favorite as it’s a good ‘starter’ graph for generative design and has worked well for at least two dozen companies over the last six or seven years.

Also this was going to be one of my proposals for AU or BILT this year… so that should tell you a few things:

  1. I have done this before so it’s possible
  2. Others want to do this but struggle
  3. it will take a lot of work
    If it gets accepted somewhere I’ll be sure to post to the forum for others but may not remember to link this particular post.

To start with you need to define each piece of equipment in an external data source, as Generative Design doesn’t have ‘live’ access to Revit, and most Revit families lack the required parameters for things like ‘required connections’ (the UPS and battery). These definitions need to include a name, a description, an ID (mark or tag at the instance level, but they should be integers), required proximities, the BASIC geometry of the equipment and it’s clearances. The three purple boxes with some sort of thing going on in them are over detailed for design purposes - they should just be a rectangle if you’re only looking in 2D, or a cuboid if you’re in 3D. I also like to include color data (12 digit numbers) and a few other things here, but this works for the most part. Serializing to JSON can work for this, as can just giving a geometry type (Cuboid; drum; tower; etc.) and properties thereof (height, depth/diameter, width/radius), or even a path to a SAT file or similar format. All geometry should be with the back (wall side) of the equipment on the origin, working into the +X and +Y quadrant. I recommend using a CSV for storing everything, but you can use families or Excel, or even a real database. Up to you what you use. Note you don’t want a ‘count’ field here - duplicate the entry N times instead.

Next you need to define a way to pull these into Dynamo and generate a dictionary of each object. This dictionary should include every property in the definition but replacing the geometry with actual Dynamo geometry - one for the clear space and one for the physical object. Add the width of the bounding box of the combined clear floor space and equipment as a ‘total width’ key as well. When done with each equipment you should have a list of dictionaries with a key for anything you know about the object.

Now you need to build a way to iterate your equipment sequence - I like to use a permutation to do this. I have a node in the package ‘Generative Design At Hogwarts’ for an implantation thereof. By pulling the Nth permutation you can set up a number slider for a range something like 0 to the factorial of 18 (18! if you’re into short hand) and get any one sort order of an equipment list 18 items deep. If you need more than that (say your equipment list is 19 items long)… well you group by system or common objects and use two permutations. Permutate the list of dictionaries using the slider and now you can sort first to last, last time first, or any lexicographically ordered sequence in between.

From there you need to define the thing you want to populate. You can do this a LOT of different ways, but I recommend using the perimeter of the room as a polycurve, breaking it at the door (including clear space!) so you can get in/out.

Now we need to define ‘where we can put equipment’ using coordinate systems. This can be done with design script, Python, C#, or regular nodes. I’ll go over the process for regular nodes here as it’s simpler. Basically you take the width of each object, and use a mass addition technique to get the ‘total length’ at which a coordinate system would need to be placed if the objects were directly against each other. Then extend the start of each curve by the length of all curves proceeding it (so the first curve doesn’t extend, the second extends by the length of the proceeding curve, and so on. Then you place coordinate systems along the sequence of extended curves for each length in the mass addition. Next you trim the start and end of all the original curves by a reasonable depth (use a slider for this initially). Finally filter out any coordinate systems which do not touch the associated trimmed curve. You now have a coordinate system for each equipment (or as many as you can fit).

Transform each your equipment’s geometry and clearance by the associated coordinate system, and add a new key to the dictionary for ‘located geometry’ and ‘located clearance’, and add the coordinate system to the dictionary as ‘location’. You can also build and add a key for the display (using the color and the GeometryColor.ByGeometryColor node) if you’d like.

If you made it this far, congrats - you have generated A design. Now we need to evaluate so we can find a ‘best’ design. You’re almost there - we just need to evaluate the design.

First it would be good to know if we have more equipment than we have available spaces. Any equipment which failed to get a location or transformed geometry didn’t fit, so we should count those to get a ‘fit’ score. A ‘perfect’ score would be zero,
and an ‘imperfect’ score would be approached as the number grows, so we will want to minimize this value.

Next we need to define the occupied space as a single object. Bring the walls, columns, and any other obstructions into Dynamo, and union them into one thing. If you’re working in 3D this thing is a solid; if you’re working in 2D it’s a PolySurface. We also need any clearances from inside the room (doors, a central walking path, etc.), again as a single thing.

Now we need to take each of the placed equipment geometries and get the total volume (if working in 3D) or area (if working in 2D) of the intersection intersection with the equipment and:

  1. The combination of all clearance space - from the room and from all equipment (including itself). Any volume (or area if in 2D) here is an indication that the equipment overlaps a required clearance, which is bad.
  2. The combination of all space occupied by all other equipment and the room. Any volume (or area if in 2D) here is an indication that the equipment overlaps another piece of equipment or a physical part of the room.

If you sum #1 you get a good ‘usability’ score, and #2 above you get a good ‘buildable’ score. In both cases ‘perfect’ would be zero, and ‘imperfect’ would be reached as you increase the value, so we would want to minimize this.

Next you can take each piece of equipment and pull the ‘desired adjacency’ key (remember that adjacency part?). It can help to build a dictionary of the list of equipment using the ID here, but you can manage with the lists as well. Pull the geometry of each desired adjacent equipment and get the distance from the equipment to each of the desired adjacent geometries. Note that if you had any ‘unlocated’ equipment in the design when you attempt to find the distance between the located objects you’ll get a null value. I recommend replacing the null with ten times the distance between the minimum and maximum points of the room’s bounding box. This way anything needing a connected piece of equipment that hasn’t been placed will give you a penalty that is 20x the worst possible design you could ever achieve.

If you sum the total distance for all adjacencies you get a good ‘adjacency score. A ‘perfect’ score would be 0 (all equipment is directly touching the equipment it wants to be near) and ‘imperfect’ is reached as you increase the value, so we would again want to minimize this.

Now you’ve got a way to generate unique designs by way of changing the permutation, and evaluating each for fit, adjacency, usability, and buildability… Generative design can now attempt to find the optimal sequence of equipment around the room. Go ahead and place the actual equipment at each coordinate system in the model. It’s worth noting that the design isn’t done - you’ll want to massage things a bit. The result should be pieces which you manipulate slightly, as you know to order the equipment in the sequence [5,7,2,1,6,8,3,4] instead of one of the 40320 other options (yes that is the real number).

As I noted way you there… it’s a LOT to do the first time out. You’ll get faster with it as you go though, and much of what you’ll build is reusable over and over, so don’t give up just because it’s hard.

Thank you for such a great response, as you said is a lot of information and they’ll probably be a lot of questions about this in the future, I’ll start working on this since it looks like something that will take a time, again thank you!