Monday, October 7, 2013

Dynamo and Revit adaptive components

For quite a while I have been following Zach Kron, who writes an excelent blog on dynamo with Revit. In this post he writes about using excel to drive geometry in revit: http://buildz.blogspot.nl/2013/10/data-from-others.html

He was so nice to share the files he used. After looking through his files I got the idea let's see if I can great a simple bridge. I was thinking about creating something out of segments. So I have this bridge in mind which I am going to chop up. I had something like this below in mind.
I needed to do two things, create an excel file and create a good adaptive component.

The adaptive component
I decided to start out with a simple adaptive box. The box has 8 adaptive points.
In order to create anything I need to define xyz coordinates for every adaptive point for every segment.
For this bridge I had my mind set up to us a nice sinus wave for it's design. This is what the dynamo create for me.
The excel file
The easy part of this file was seting up the x coordinates. I have set the x coordinates with a spacing of 3 meters x 30 segments = 90 meters (at first I was just playing with the numbers without thinking of measurements, the bridge turns out to be insanely wide. It's all adjustable to more realistic measurements but I will ignore it for now)
See image for directions of the different axis. Notice the positive and negative Y axis.
The hardest part of this all was trying to figure out how sinus functions work. Highschool math had certainly moved to a dark recess in my mind. So it was google to the rescue. After a while I had setup this formula: Amplitude*SIN((PI/circulair frequency) * x-coordinate))+shift
The amplitude gives me control of the bulge. The circular frequency is important for creating a curve which is similar on the right and left side of the bridge. With the shift I controle the width of the bridge.
These two graphs control the Y coordinates. So points 3 + 4 curve more than 7+8. You could read the graph as seeing the bridge from a top view. The other points use the same coordinates but than negative. Another thing I needed to add was that the coordinates of the next segment needed to share those with it's previous segment. See image.
The Z coordinates are created with the same formula as the Y coordinates but with slightly different numbers to create another sinus wave.
The curves below are used for the Z coordinates. Imagine standing in the water an looking straight at the bridge. point 1,2,3,4 travel along the lower curve and 5,6,7,8 along the upper curve. This makes the bridge thinner in the middle.
Here an impression of the excel file. (this sheet is for doing the calculations, the one called: coor is the one that is read by dynamo.)
Once I got the bridge working I could use parts of this excel file for generating the railing as well. I created an adaptive component. The family took me a little while to get right. (althought the railings are still intersecting the balusters)
The piece of geometry that is turned of I needed to host the points for the railings. This was the only way that I found so they would behave they way I wanted. The second baluster is turned of by default and can be turned on with an instance parameter. (needed for the last segment)
The two bands here are modelled as an inplace component using sweep. The path of the sweep is picked. I used the edge of the bridge and then I off setted the profile. 

Because the way that this dynamo script worked I had to put the bridge components in another file that the railing. Rerunning the script in the same file deleted the previous geometry.

None of this would have been possible without the dynamo script that Zach Kron provided. See image and please do look at the link provided above.

The nice thing that I found so far is that the script supports creating geometry with different number of points. I have seen it work with 2, 4 and 8 points. 

Just one more thing The idea of this model was to see if I could get it to work. I was not concerned about creating a real bridge.  

The files I used are here:
https://drive.google.com/folderview?id=0B83rceLDUFtYY2hCRDFVTVJ5bDA&usp=sharing



  
Post a Comment

Google+ Badge