As COVID-19 continues to impact everyone, Microsol Resources is committed to helping our customers and communities. Need up-skilling and training? Need help to keep your team working together and collaborating?   LEARN MORE >


Revit Adaptive Components: Automated Placement: The Vaulted Ceiling – Part Two

By Microsol Resources | BIM
Typical Manual Placement of an Adaptive Component
Typical Manual Placement of an Adaptive Component

The next part of this two-part series focuses on the actual placement of the adaptive component (This is the link to Part One). This part might tend to get boring since it entails the endless picking of Grid Intersections for all the bays of the building. Fortunately, this does not have to be the case: anytime you see a repetitive task, think of the purpose for inventing machines – the computer in this case. The only variables in this case are the eight Adaptive Points and they can be abstracted away in terms of their x & y coordinates ( the z coordinate is not being considered since it is being controlled by the internal instance parameters of the Adaptive Component). Once this information is read by a python code, it is just a matter of telling the python code to place the Adaptive Points at those coordinates.

I am no programmer, but reading through Nathan Miller’s blog, The Proving Ground, I was able to cobble together some of his code structures and tweaked it to place my Adaptive Component. I’m sure there’s tons of room for improvement – optimization – I believe is the technical term. I have posted the final version of the code further down, but for now I’ll describe the process linearly.

The first Step is to obtain the x & y coordinates on which the Adaptive components should be placed. In our case, the points coincide with the Column Grid.

Coordinates on a Grid

This can be easily done with the Spot Coordinate tool within the project environment. This information can then be manually transcribed into a spreadsheet. I’m sure one can write a routine to automate this process, but then I decided that it would be more computing than I can handle at the moment.

The code that we write will have to do three things:

  1. Prime the Adaptive Component for Placement
  2. Open the Excel File and read the x & y coordinates for each placement instance of the Adaptive Component
  3. Place the component at the points indicated by the x & y coordinates listed in Step 2.

Below are the steps that describes these steps and the intermediate steps in detail. WARNING: The description is solely my interpretation of what’s going on and may not be what’s actually going on. Hey, but if the ends justify the means, this is it!

Spreadsheet Transcription
This Step Initializes the code, loads all the requisite libraries and starts the transaction. Code01
This step makes sure that you have Excel installed and it can access it. Code02
This is where you specify the number of instances (Bays in the ceiling) you want to place an Adaptive Component it and the number of Adaptive points in the component Code03
This is where you tell the software where to look for the x & y coordinate values. Essentially, you are specifying where to start and setting up the end points based on the Number of Bays you specified in the previous step. Code04
Start the outer loop to run everything inside the loop for as many times as the Number of Bays. The operation inside essentially consists of placing a single Adaptive component. This particular step consists of assigning the name of the Adaptive Component Family to a variable (symbName). Then we prime a ‘Collector’ object to pick the Component by Resetting it. Code05
Next we iterate through the project to find the Adaptive Component Family and the instance properties of each point. Once we find these two ‘Objects’ we can then assign values to place the Component. Code06
This step initializes three ‘array’ variables for 1) the Adaptive Point, 2) The Coordinate Location of the Point, and 3) the Translational Motion required to place the point from the initial 0,0,0 location. Then we create a loop that initializes each of the Adaptive Point objects (adptPoint[i]) using the aPt.append() method Code07
Next we have a nested loop (this could have been differently based on how the Excel Spreadsheet was set up) that collects the x & y coordinates from the Excel Spreadsheet (using the loc.append() method) Code08
Finally, each of the Adpative Points are moved to the Coordinate x & y locations using the ‘ElementTransformUtils’ function using the initial location (adptPoints[i]) and moving it to the final location using trans[i] variable that is read from the spreadsheet. Finally we finish the operation by committing the transaction. Note: I had to use the variable ‘j’ for this to work as expected. I will appreciate any input that points to the flaw in the logic. Code09

Finally, after a couple of days of bitter wrangling with the Iron Python I was able to get to the code above. I know that its far from perfect, but this is all I had time for and any suggestions to improve it are more than welcome. Below is the result of running the code.

[vimeo http://www.vimeo.com/58500752 w=720&h=405]

Automating Placement: Adaptive Components from parametric analytics on Vimeo.

And here is the code on pastebin… have fun!


About the Author

Microsol Resources delivers integrated solutions that help customers design, simulate and analyze their ideas, increase operational efficiencies and maximize their return on investment in their technology solutions.