algorithmic modeling for Rhino
In this video, I explain how to setup a Grasshopper definition that will write the G-code for 2D shape milling on a 3-axis milling machine. G-codes are the codes that position the tool and do the actual work, as opposed to M-codes which manages the machine. Actually, there are a whole host of different codes that can be written to control a CNC mill, however G-codes are what we are most interested in for this definition as it will allow us to streamline our fabrication process by sending the parametric data from Grasshopper directly to a CNC mill.
In this example I write the tool path information for a 2D Vornoi Pattern generator, originally written by Sang Hoon Yoon. You can find his vornoi diagram definition on his site www.sac3.blogspot.com. This video explains how to use your data-structure (trees) to help weave together various text strings which control how the CNC mill head will operate.
I have formated the text strings to work with the open source ShopBot CAM software. This software is excellent for many reason, not least of which is the fact that it's free and has a large online help community... much like Grasshopper. It also allows the user to preview the cut even if their computer isn't connected to an actual CNC mill which can come in handy while testing out your cuts. Syntactically, ShopBot part files are setup slightly differently from traditional G-code which harkens back to the days when cutting files were stored on punched tape and it's format was optimized for brevity. You can find a lot of helpful resources on how to setup ShopBot part files in their Programming Handbook.