BIM works flows of using Autodesk products, such as Infraworks, Civil 3d, Map 3d, Recap Pro and Navisworks that makes my life easier.

Wednesday, January 06, 2016

Excel to Revit using Dyanamo

I've now been using Revit for 10 years and only in the last month through the use of Dynamo have I been able to use a command line like AutoCAD (on Steroids) . Revit does not have a input command line where you can specific coordinate but dynamo gives you the availability to do just that.


The image of the Dynamo script below uses excel as the input for coordinates and then the matrix transposes the point to suit the Revit base point to insert the point base family.
The above appears to be a complex set of node but real is just a simple connection of node that performs a simple task; 

1. Read the Excel Spread Sheet
2. Process the Excel sheet into a list
3. Get the Project Base Point and rotation
4. Matrix transform the point from the Project base point
5. Insert Point family from the transformed base points












The above image is a group of nodes to read the excel file.

The first Row within Excel has a heading (fields) that needs to be removed from the list to allow the clean list. 

Excel has a series of cells in which each data entry occurs. To make the data usable within Dynamo the data is required to be processed. The first set is to transpose the list in excel and then from there each column is broken into an individual lists. 


The individual list than can be used to transform the points as well as other functions within Dynamo. Using a simple Python script to split each column into individual lists.



Group of nodes to get the project base Point.


The next node group is thanks to Wikipedia! If you can understand Revit shared coordinates well try to think of it backwards!!!

Revit's project base point is the mathematical set out point of the graphical data base. The project base point removes large numbers from the data base and makes the math simple. I actually don't know how to write it in words but to put it simple if you had the option of x =235982030, y=230923092, Z=14000 vs  x=1, y =1, z = 1 for every point as a reference point which one would you chose?  Well, Revit makes it simple by using 1,1,1 and tell base point is the large number which is multiplied by linear algebra.  To get the reverse into Revit from Dynamo you need to take the points that you have and Matrix transform them from the Project base point and rotation to true north. Year 12 linear algebra, comes to mind.

Refer to the Wikipedia for Matrix transform https://en.wikipedia.org/wiki/Transformation_matrix

Rotation[edit]

For rotation by an angle θ clockwise about the origin the functional form is x' = x \cos \theta + y \sin \theta and y' =  -x \sin \theta + y \cos \theta. Written in matrix form, this becomes:[4]
\begin{bmatrix} x' \\ y' \end{bmatrix} = \begin{bmatrix} \cos \theta &  \sin\theta \\ -\sin \theta & \cos \theta \end{bmatrix} \begin{bmatrix} x \\ y \end{bmatrix}

Simple math but complex to get at the start. 


Once the Points have been reversed transform then can be used as points within Revit


Download the Example Dynamo Script Link

Download the Example excel Spreadsheet link