algorithmic modeling for Rhino

Hi all,

I have been consolidating ideas on making a CAM plugin for GH. This is due to the fact that more and more RH/GH people are working with a CNC router, with a plugin that adds the ability to parametric create 2D or 3D cuts are definitely helpful.

I'm still at the stage of drafting the goal and audience description for the plugin. and the next stage is to programme it. I don't have all necessary skills yet but will try, hopefully someone will join the team.

Goal (Draft)

A plugin that is easy enough for most GH users to use. It aims at creating toolpaths in a parametric way, allowing reuse of definition settings, quick design change, and able to process large batch of information without error.

Audience (Draft)

  • GH users who designed structures in GH, own or work closely with a CNC machine.
  • CNC machine owners who need a easy to use and reliable CAM package. Esp handling large batch of cuttings.

Functions - Toolpaths

  • 2D , 2.5D Curve following - with multi-level 
  • Drilling, Drilling cycles
  • 2.5D Profiling - with multi-level 
  • 2.5D Pocketing (Next Stage)
  • 2.5D Facing (Next Stage)
  • 3D Roughing (Next Next Stage)
  • 3D Sweeping (Next Next Stage)

Functions - Outputs

  • Direct NC File Generation (Easy to use header and footer info)
  • Multiple possibilities for postprocessor (Cater different machines)
  • Toolpath optimization for unorganized input
  • Support multiple tools (works with ATC machine)
  • Per toolpath based control for lead-in, lead-out methods, feed rates
  • Per toolpath based definition of cutters.
  • Combine multiple tool paths in NC file.
  • Handles data trees of input


Geometry engine will rely on Rhino SDK (Offsets, Transformations, 3D)

Most logic can be written in (I'll test write as custom VB component)

Package distributed as a plugin (I don't know how to do that at the moment)

---- On going edits to the post as ideas unfold ----

Todo List

  • Make an action plan on mile stones for the software development
  • Make a list of the required programmers role and who to fulfill it.
  • Start UI / logic design, create dummy scenario (usage case study) for brainstorming.
  • Discuss and decide on whether Open Source or not
  • Study and compare existing CAM software on market. (eg:MasterCAM, RhinoCAM, V-Carve Pro,MadCAM)
  • Study other plugins and look for potential to collaborate or integrate and to clearer define this project's stance. (eg:Beaver,Lobster,CAMel)

Views: 9606

Replies to This Discussion

Hi all, 

Just found a e-book from MIT about "Surface Interrogation for CAD/CAM"

Hi Victor,

Have you looked at Rab Gordon's CncToolKit - the plug-in for 3dxMax?  It's open source & maybe someone can translate parts of that to Grasshopper  Is this a possibility?  I have been able to modify the CncToolKit slightly to work with a head/head 5 axis machine without much trouble, but there are still a few issues, plus Max is a little cumbersome to use compared to Rhino.

Some food for thought.  Edmund Harris (CAMel) and Rab Gordon have talked somewhat in the past, but I don't think there is much movement on it yet.

Here's to getting something moving.  I'm going to check out Beaver & Lobster.


-Mike Calvino

This is some great work Victor,  What a great start!

I'm not sure if I'll be able to add anything to your efforts, but I'm looking over the plug-in & may try some parts & adding a 2d part extractor in the next few weeks.  I know that Mach3 has a time,r usually on screen4(toolpath screen), that gives really accurate machine estimation as it uses the motor tuning profiles that are in the screen set in use.  I know it would be handy right in GH, but maybe lower on the list.

My priority would be on creating some components that could start with your model (preferrably 3d) and extract 2d parts & generate the toolpath from there instead of having to start from a drawn toolpath (your Intl, & Extl offset lines.) 

An outline extractor definition is fairly simple to create, but I get hung up on selecting the right surface of the solid part(I just have to manually select the flat side surface with a slider right now).  Then the components to define a group of parts to cut out & automatically recognizing inside cuts (cutouts) and outside cuts(outlines) would be next.  This would just be a set of components that would precede your definition.  (of course I'm talking about 2d at this point.)  See attached definition & test file(Rh5)

Surfaces with surface normals, for simultaneous 5 axis would come next/later.  Anyway, I just wanted to say thanks for your great work & I hope I'll able to contribute in some manner.

I'm not sure if this is really part of your effort/plan, but I think would be a big time-saver for users.

I also know there's RhinoNest that can pull apart a model & nest pieces on sheets the user defines, but I don't think this has to be that complex.

I'll keep in touch,


-Mike Calvino


Hi Mike,

Thank you for your reply.

Regarding the other plugins, I would like to look at them. There must be something that I can learn from them or if they are interested to collaborate. I have been exchanging emails with Edmund on CAMel. But I haven't had time to study it yet (will do it tonight) or discuss with him in details.

Beaver & Lobster are also interesting, but I think they are aiming at something a bit higher right now, I focus more on getting the automation / batch process right at the moment. But I promise I'll look at them in details. Note I'm also interested in developing something up to 5 axis  (head head) machine. Robotic arm is a bit too much for me, since I aim at creating a plugin more for batch production and real construction more then experimental stuff (since most experimental researchers are able program routines that they need any ways)

Time Estimation - Yea Mach3 is a nice driver. But I start to think that most CNC programmer or even operator don't know how their machine were actually configured. Not many people know what motion profiles, look ahead or even acceleration. So I don't know how the acceleration profile could be a setting that a general programmer could enter and get an good estimation. /// One way of getting a more precise estimation is to use a simple trapezoidal speed profile and make a guess. /// Another way is to just sum up the speed X distance (Even CATIA and MadCAM do it this way.)

The file you have uploaded, 2dPartsGeneratorTest.rar, I couldn't download it from the forum's server, seems to be a problem with the rar file format. I can download your .gh, but I can't understand it without the Rhino file. And sorry, I also have only Rhino 4, no money at the moment.

Outline Extractor? Can you explain more? 

I had difficulty making good and reliable offsets with some 2D curve input, I'm not sure if it is a Rhino 4 problem or if the new RHino SKD haven't improved that yet.

I do not have intent to overlap with RhinoNest, RhinoNest is already nicely developed with integration with GH, I think RhinoNest or other Nesting software users can easily perform nesting in Rhino or in GH (such as RhinoNest in GH) and the results are fed to this package.

Thanks a lot for your info.

By Outline Extractor I mean you can select a brep in a model (say a flat piece that will be cut from steel or aluminum sheet or plate) and then generate a 2d line drawing of the outline & holes of the piece, that is mapped to the world XY plane & with as many parts as you define.

The definition is a sketch right now & so is not labeled so much, but the brep component at the left is where you reference the component you want to make a 2d of, then you use the slider labeled "Face#(percentage of # of faces)" to select the correct face(I think I can make a component that will automatically do this) , then adjust the X spacing of the 2d drawings, select the #Pieces, & bake the "Curves to Bake" component.  Maybe it's a little involved at this point, but it's a start & beats doing all of that manually.  This gets you the 2d of the parts you need to cut.  Next would be a way to automatically generate the toolpath lines whether it's a "cutout"(being inside & outside of 'grouped' lines) or outside or inside cuts.

Then it would connect to your definition for defining feedrate, stepdown, end depth etc. + the g-code output.

I agree, a nesting program is not what this is about right now.

I actually think CAMel is along the lines of Lobster & Beaver - something more specific & involved.

That's why I'm excited about yours as a general plugin that can produce general 3, & eventually 4 & 5 axis G-code for production & cutting.  I think with that platform working we can then tweak it or modify it to accommodate more experimental stuff.  But for now, many need to be able to generate production code in a tightly integrated workflow like Rhino/Grasshopper.

A Rhino4 file in .zip format is attached that can go with the gh file.

Let me know what you think - maybe I'm miles behind . . .



Good idea for the CNC generator.

I coded one from scratch about 6 years ago, in, of all things, basic. parameters were input as part of the code definition, with out a user interface. output is Gcode (using G0, and G1, only), using mach3 as an interface and device driver. 

Application is carving jade; using a highly modified mill with diamond tools; run times were on average 5 or 6 days. i coded a runtiem estimator, which was dead on accurate, using simple averaging of distance x speed, then divide by total distance. works very well.

My design decision to generate gcode, and then mach3 for contro,, was a no - brainer. Mach handles all of the difficult machine control issues; all you need to do is generate g-code.

an idea: to keep things simple, don't worry about arc generation, have your output, for everything  as a series of simple linear moves. my files were large, as I do complex 3-d curves, so i could easily have gcode files of 3 or 4 Mb. but so what, disk drives and memory are cheap.

Hi Victor

What is the latest status of your work. I've built a 4'x8'x8" router in my garage and have been exploring all things CNC lately. I would love to couple GH with the router in a more direct way instead of typical export/import.

I use Mach3 for machine control and various GCode generators. As an experiment, started a simple definition to generate drills using the image sampler. I hope to wrap it up over the weekend.

excited to read more



Hi Jonah,

Nice to hear that you are building your own machine. It must be a big DIY project for such bed size.

I'm currently engaged in a big project in my company of combining the powers of GH and CATIA, therefor not much time for this development. I should be more free in the coming September as I'll leave my current job for further study in MIT. I'll definitely continue the development then.

If you want to see the latest script in action, please see my last comment on March 12, 2013 at 10:49am which has a zip file of the latest thing.

Hello Victor,

I don't know if this would be useful, but I have been working along the same lines as this project to produce a series of Grasshopper definitions that perform typical 3-Axis processes on Rhino surfaces.  Thus far I have written scripts for:

Pixelated Image-Based Hole Pocketing:Milling:

Pen Tool Script (for use with a sharpie in the machine):

Parallel Surfacing:

I just completed Plunge Roughing, tested in CNC Simulator Pro.  Image/page coming. 

I am producing these files as part of a nascent digital fabrication internship I am running at the University of Washington, so they have yet to be combined into components in favor of students taking them apart for understanding.  I intend to produce a series of typical operations within grasshopper without the use of any scripting, i.e. all done with stock GH components.  If it would be helpful to simplify them into clustered components / one big grasshopper interface, Let me know and I would be happy to contribute.  

Best of luck in your other endeavors,


Hi Taylor,

Nice to hear from you. I have just went back to school this month, in MIT. I originally thought I might have more time to work on this plug-in after I leave my work and go to school. Seems that I'm so-far wrong about it.

My intent to make this plug-in or clusters of components is the desire to make CNC process easier for everyone. My reason to write it in is because it is much easier to handle complex operations using custom written class objects, instead of messing with datatrees. I can also write loops and optimizations much easier.

I aim to make the components as simple as possible as outlined above, even if that means reduced functionality.

  • 2D , 2.5D Curve following - with multi-level 
  • Drilling, Drilling cycles
  • 2.5D Profiling - with multi-level 
  • 2.5D Pocketing (Next Stage)
  • 2.5D Facing (Next Stage)
  • 3D Roughing (Next Next Stage)
  • 3D Sweeping (Next Next Stage)

I'm interested to start 2D operations first, and slowly moving towards 3D surface interrogation. the main reason is because 3D tool-paths are much more difficult to create. By 3D tool paths, I mean creating cutter diameter compensated tool paths, not paths on a surface. (Not follow curve type).

I have experience in CATIA CAM and I admire its parametric capability. I think I'll draw more parallels from it. The great thing about it, is that it has good control of parameters and relationships (which GH can happily do), and simple tool, axis, and base definitions.

I'll be interested currently to find some funding that can fuel me scripting. Unless the Boston winter is so cold that I cannot attend class, then I'll stay in my room to script.

It would be interesting to see how u get on with creating drilling cycles from the image sampler. I had wondered about creating holes drilled to depths generated from image greyscale and drilling into a laminate with layers representing the greyscale

I used a grid of sample points and remapped the gray value to a value from 0 to the diameter of the ball end mill.  That way a full black pixel gets a full diameter hole and a white pixel gets barely touched.\

I did it here with a .125 ball end mill.

CORRECTION: The slider that controls "Tool Radius" actually is the tool diameter, hence the division by 2 in the remapping.  






  • Add Photos
  • View All

© 2021   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service