Saturday 31 August 2013

Automating AutoCAD



Automating production of 2D drawings from 3D data through Grasshopper. The fabricator required us to produce per-layer drawings for each panel in the structure (6 layers x 12 panels x 3 structures), and annotate the X-Y-Z coordinates of several points on each curve. And we had 3 days to do it. Thus was born this:



Pseudocode:

1. Take base geometry (generated through another process), and panel split lines (drawn manually)
2. Identify the components of geometry by tags and split them
3. Lay them out in 2D space
4. Compute necessary annotations, grid, text, keyplan, coordinate data, etc.
5. Iterating per-panel:
      a) bake all geometry associated with the panel in relevant layers using the ObjectAttributes class
      b) store the Guids of the objects baked in this run
      c) once baking of the objects in the current panel is complete, select them using the Guids stored
      d) call -Export on the Rhino command line through Rhino.RhinoApp.RunScript()
      e) watch as your windows folder populates itself with the drawings :)

Acknowledgements:

Philipp Ostermaier for the awesome key-plans in each sheet and vital contributions to the code.



No comments :

Post a Comment