G-code for a CNC Mill

Is there any plug-in for grasshopper that can generate g-code for a CNC mill.

https://www.food4rhino.com/browse?searchText=cnc&form_build_count=1&f[0]=im_field_term_reference_price%3A767

Yes, but I want to know which one is recomended bro. I can even google, ya know :slight_smile:
Have you used any of these yourself?

For better or worse I don’t work with CNC. Haven’t since highschool and back then I didn’t know Rhino. Damn, if I had Rhino and Grasshopper back then…:wink: :stuck_out_tongue_winking_eye:

Is what you require that difficult to do with some ghpython scripting? Can you show a picture or a sketch. I remember there were different machines out there and the G codes used by each of them was slightly different

1 Like

I am fooling around with RhinoCAM. But I am currious if there is anything that works with Grasshopper.

It is a simple thing. I am milling the insides of an alluminium profile. It looks like a U channel with some extra material inside. It is a hobby thing. I am testing this little machine a friend build. And yes you are right there is a difference between the g-codes of different machines. It is not a straightforward thing. But yeah, I am doing this out of curiosity.

Does the machine do curves or small straight lines? Perhaps breaking your curve into n-points then getting coordinates and transforming them into G-code is the way to go. Shouldn’t be that difficult with python.

how many passes does it need to do? What is the thickness of one pass? I think this is the required info to get the code.

I can tell you next weekend. The damn thing is 400 km from where I am.

:smiley: ok

Its not too hard to turn a list of points (for example) into simple G-Code.

G1 X10.0 Y10.0 Z0.0 F750
Move to (x,y,z) with a feedrate of 750 mm/min

you can concatenate text with your point coordinates to create a list of G-Code commands.

You need to know if you will need to add a header and footer to your program and what needs to be in that.

You might need to include spindle commands i.e turning it on/off and setting speed.

You might need to add traversing sequences to lift the spindle and move to a point above the workpiece before moving to the start of the next machining operation.

The list goes on!

I use CAMBAM because its cheap and easy to use for 2D pockets, profiles, engraves and 3D contouring from STL mesh format. It also has some interesting user-created plugins.

Search for user Siemen on here and the old forum - he’s done some nice work creating patterned surfaces by generating G-Code.

CNC TEXTURE SAMPLES

2 Likes

If you are interested in making your own in python, the link below could be useful for you.

1 Like

Here’s a demo three-axis post I put together - it needs to be adjusted to incorporate specific machine needs - M and G codes (make sure these are right, you don’t want to get problems during tool changes or turning on / off the spindle etc.)

Obviously a home-made post from GH is going to be buggy at some point, so feel free to use this as a base for your DIY project, but I can’t and don’t take any responsibility for your hardware :wink:

Simple CNC Post.gh (7.6 KB)

1 Like

I still use this often for milling:


There’s a lot that can/could be improved from a programming, a functionality and a UX point of view but both Jens and me have been a bit busy these days to work further on it. We hope to get back onto it some time soonish.

Anyway, the grasshopper code is completely open so you can dig into it and see what you can reuse. It might be a bit overwhelming though so if you’d like to start from scratch the definition above or the instructable I made a few years ago is a good start.
Comes with no warranty obviously.

@ryanhughes Divide doesn’t consider curvature of your curves. You get better results (and shorter code) by using Curve to polyline and then extracting the control points.

6 Likes

Hey siemen, BB looks cool, I haven’t seen that before. And sure, there are probably 100 different ways you can do it (cutting with arcs and lines to approximate NURBS etc.) but it’s something I just whipped together for the OP because they seemed interested in starting to build their own :wink:

P.S, starred it on Github, I might be doing some research on design-for-manufacturing of prefab housing soon, will try to contribute if I can find time.

Hola, estoy aprendiendo a usar Grasshopper en Rhinoceros y quiero conseguir, a través de código G, dar una cierta inclinación al cabezal de la impresora para que esta imprima por ejemplo a 45º.
Se que se puedo hacer utilizando cĂłdigo G en Grasshopper pero aĂşn no he hallado la forma de hacerlo.
Espero que me ayuden, gracias.