Using grasshopper to automate workflow

@Ben_Wilkinson I created a new topic for this since it’s getting off the topic of the thread we were posting in.

I like using grasshopper for automating these kind of things, so I thought I would give it a try.

I’ve put together a grasshopper definition that will take this:

And produce this:

I was able to process these 3 shapes in less than a minute.

  • Enter the name of the layer containing the source polysurface.
  • Select the slicing interval.
  • Select the offset distance for the silhouette.
  • Toggle Enable Bake to True by double-clicking.

Note: If Enable Bake is set to True, any change in the inputs to the baking scripts will result in objects being added to the Rhino document. Use caution because it is possible to create duplicate objects if bake is triggered multiple times.

The baking could be done using plug-ins, but I’ve used Python so the grasshopper script does not require any plug-ins.

test _objects.3dm (715.6 KB)
slice (23.7 KB)

Let me know if you have questions, find bugs, or want anything changed or added.



Hello Kevin,

Thanks so much for doing this! Grasshopper is a remarkable tool and I need to get more into it. The possibilities seem almost endless. This tool saves a huge amount of time. In terms of working it, it seems straightforward though I didn’t see silhouettes of all the layers when I first ran it. Will look into that more. I should provide a bit more context for this. When I’m preparing for a CNC cut of a mould like these, the layering is needed for a couple of reasons. One is just to save material. The other is often necessary as the shapes don’t allow the router to get to the lower layers if the layers above were in place from the start. So I start by machining a (normally 6mm) offset shape, then place it on the bed, do the contouring of the sides, before gluing another layer on and then repeating the process. So I take these offset contours, export them as dxf files. I have written a VBA script for my CAM package (called Alphacam) which takes all the dxf files, puts a toolpath on them and then does a nesting operation to see how best to optimise the blank board material. I have further developed my python script (I’ll attach it) to automate the export of the dxf. It also takes account of more complex shapes (not that unusual) as sometimes I get separate ‘islands’ of solids in a layer. So what I have so far (obviously my contribution has been negigible!) allows me to get as far as the nesting which allows an extremely rapid material quantity assessment. This used to take about 4 hours and now about 4 minutes! But there is one more stage which I’m going to work on next. I need dowel holes in the layers (normally 3-4 per object) so they locate correctly. I just machine these when doing the outline shape. So I’m going to look at how to do these holes. They might have to be manually placed as sometimes I can’t allow the holes to show once the machining has been finished. But I thought I’d try to automate it as well. I’m enjoying doing all this and have the time for once as I have a new machine on order and can’t do much until it arrives. This ended up being too long - sorry but I started out thinking context might be useful!

Thanks again. I’m sure I’ll be back in touch when I can’t do the next stage but I’ll give it a go first.

Combined Slices and (4.2 KB)
Moree complex shape for layering.3dm (4.8 MB)

It looks like your python script is coming along nicely. It is helpful having a more thorough understanding of your workflow.

I wasn’t sure if you wanted silhouettes for each layer or just one for each object. Took a guess and just made one outline for each object. I had a 50/50 chance, so of course I made the wrong choice :crazy_face:

I made some changes to the grasshopper file I uploaded previously:

  • Now creates a silhouette for each layer.
  • Uses parent/child layers when baking.
  • Code added to export DXF files of silhouettes. (30.9 KB)

Previously uploaded Rhino file can be used for input.


Hi Kevin,

Thanks yet again for all your help. The grasshopper script is brilliant. I’m going to have to do a lot of work to understand and be able to reproduce it but very keen to do that as it is such a great tool. No need for further mods, but I thought I’d let you know that I did some work on the dowels. They have to be placed manually as there are too many variations in shape possible. What I ended up doing is creating a layer with prefix (‘D’) that I manually put the dowel circles into, appropriate for each layer. The the script picks up this layer every time it’s doing an export. I’ve done this for one of the more complex shapes and it doesn’t take too long to do. When the dxf is imported by Alphacam it has the circles and main outline but can distinguish between based on layer name which is also there.

Incidentally, when Rhino exports the DXF file, it splits the continuous line into (probably) the original segments (at least that’s what you see if you re-edit just the DXF file. It’s probably possible to fix this with one of the many settings on DXF export but I tried a few and they didn’t change it. Alphacam doesn’t seem to mind this as it joins up all the lines anyway.

Thanks again for your help. I’ve attached my latest script with the dowel processing but I’ll try to add this into Grasshopper when I’ve figured out how to.


Combined Slices Outline and DXF with (4.5 KB)