G-Code Generator How to slow down the speed in corner?

I am new in GH, I am using it for 3D concrete printing, I found a g-code generator from curves, and thank you for that. I need now to slow down the printer in corner, normal speed will be F5000, it needs to slow down to F3000 or so and go up to full speed after corner. Is it possible to add something on the curve that will generate a command F… in the G-code ?
Thank you

In a CNC controller this may be tweaked in machine parameters and not in G-code.
Check for Acc / Dec and Look Ahead. There could also be settings for Gains

Thank you,
Already checked and it s not possible with the system that was made for the CNC controll, it s call centroid…
It s why I am checking for G-code instead.
Thanks again for your suggestion !

Should be possible.

Can you post it? Or a link to where you found it? And some samples of the curves you are trying to generate g-code from?

I don’t know if I can help, but there are others on this forum doing similar things. If you can provide more information you will probably get some help.


Thank you Kevin,
I found the g-code creator online but i can’t remember where.

Curves test.3dm (564.5 KB)

gcodeGenerator.gh (37.2 KB)

Let me know if I can be more helpful,
Thanks again for helping out.

The straight lines are made by the G1 commands in g-code. The grasshopper file you supplied was set up to add a feed rate field (F) in G1 commands it produced.

The “corners” in the file you provided are arcs and are made by the G2 and G3 g-code commands. I made a change to the cluster in your file to add an F field to the G2 and G3 commands.

The input to the cluster and the input to the Expression component inside the cluster were already there, I just connected the slider and added the code to the Expression component.

gcodeGenerator_re.gh (41.5 KB)



Thank you Kevin,
That’s great, I tried it on another curve and the speed go to F3000 and remain at that speed until the end of the print, I ll check that more tomorrow. Thank you for explaining how it s working with arcs and straight line. If i can’t figure that out, I ll let you know.
Good night

Strange, it should go back to the higher speed with the next G01 command.

Looking at this further I found that there are some lines duplicated in the gcode output.

The original files you uploaded generate 122,084 lines of g-code with 895 duplicated lines like this.

I need to go to bed now, will look into this some more tomorrow if I have any free time.


Hi Kevin, good point!

I think this is where something needs attention, normally the X value should be around 5900 to 6000 and the Y value should go up too, if i understand the logic, here it s just straight lines coordinates.
I ll keep working on it.

Anyway, thank you for your help!


How do you generated the 2D contour curve?

Hi Macuso,
I found the module already made, I m new to GH and Rhino, no idea, maybe this will help you Grasshopper Tutorial (Contour) - YouTube

Best Emmanuel

Eliminated the problem with the duplicated lines and changed the logic for dividing the arcs (Fitting input).

gcodeGenerator_230127a.gh (27.1 KB)

I changed most of the code in the main cluster. If I were to work on this further, I would probably start from scratch using this as a starting template.

It works with the test file you provided and a few simple tests I put together. Let me know if you find any problems.

Have you actually printed any of the g-code you made in grasshopper?

Is your intent construction or artistic?


Wow, that is really good, thank you !

We are a very small company that just finished to build a concrete printer, we want to help solving housing crisis in Canada.
Veterans and natives are in need of places to stay, i mean good places, and of course no much money to do it… so here we are !

We printed a structure 10ftx20ft 8ft high, and we are planing to use geopolymer for the next project. From that we expect to get the attention of bigger companies that care of this housing crisis…

So thank you a lot for helping !
I will try it and run a dried print soon to see if everything works well.
I ll let you know and post pictures.

thanks again,


I just tried it … and it worked after i slide on 0 the fitting slider, at100 the same problem like before, i guess it is why it was working for you previously and didn’t work for me.

Thank you

With the the Fitting slider at 100, the feedRateG1 slider at 5000, and the feedRateG2/G3 slider at 3000 it will have:

  • 100 or more G2 or G3 lines ending with F3000
  • 1 G1 line ending with F5000
  • 100 or more G2 or G3 lines ending with F3000
  • 1 G1 line ending with F5000
  • … and so on …

Are you seeing lines that start with G1 and don’t end with F5000 (or whatever value the feedRateG1 slider is set at)?

If you don’t look closely, you could overlook the G1 lines. I just tried it with the Fitting slider at 250 and it works for me. Here’s part of the output I get when I search for the G1 lines in the output (note the large gaps in the line numbers):

The text panel in grasshopper gets rather slow when dealing with large amounts of text like this. I usually copy/past it to another program (or stream the output to a file).

If you have found certain curves that are causing this problem could you post some examples so I can try them? And the g-code output you’re getting as well.

That is very interesting, I’d love to see some pictures of that. And some pictures of your printing mechanism if you have any.


1 Like

Good Morning Kevin,
I did not see one yet, i ll keep checking for that !

Sure I ll do ,

Thank you for your help, that will really help us !
I ll probably have more requests…
Thanks again !