# Grasshopper Gcode to 3D printing

**URL:** <https://discourse.mcneel.com/t/grasshopper-gcode-to-3d-printing/153592>\
**Category:** Grasshopper\
**Tags:** mac\
**Created:** [January 20, 2023, 11:29am UTC](https://discourse.mcneel.com/t/grasshopper-gcode-to-3d-printing/153592 "2023-01-20T11:29:41Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Leblond](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/leblond/32/456655_2.png) [@Leblond](https://discourse.mcneel.com/u/Leblond)\
**Post date:** [January 20, 2023, 11:29am UTC](https://discourse.mcneel.com/t/grasshopper-gcode-to-3d-printing/153592/1 "2023-01-20T11:29:41Z")

</div>

Hello everyone !

I’d like to print on my Ender 3 (PLA) a Gcode I created through Grasshopper from a curve (svg file).  
However, I have problems when printing - the printer seems to stop after the start gcode phase. Do you know why?

Here are the files:  
[2D\_pattern.gh](https://discourse.mcneel.com/uploads/short-url/u1yGISN7LmhF8FkBzS4aK7x98wR.gh) (11.0 KB)  
[test2\_gcode.txt](https://discourse.mcneel.com/uploads/short-url/fKtHVUlexSR2wbSgE4Co4TS3YkJ.txt) (4.5 KB)  
 ![ex](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/e/3/6/e36d57c0f4e0eeabd3509b96f4a983d17b464b1a.svg)

Thank you very much !!

---

<div class="post-metadata">

**Author:** ![JoergH](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/joergh/32/590938_2.png) [@JoergH](https://discourse.mcneel.com/u/JoergH)\
**Post date:** [January 20, 2023, 12:56pm UTC](https://discourse.mcneel.com/t/grasshopper-gcode-to-3d-printing/153592/2 "2023-01-20T12:56:36Z")

</div>

I can´t open the gh file, it would be better if you internalize the imported curve.

But you can check your file in [https://ncviewer.com/](https://ncviewer.com/)

What happens is that you print a line from ca 0,20 to 0,200 and then from 0,200 back to ca 0,20

then your own g-code starts with a start point at x ca 95, y ca 106.  
I don´t know how big your print area is, and where your x,y 0,0 is located on your printer. If you try to exceed the max printing area the code most likely will stop somewhere - just a guess, as I don´t know anything about your printer. Does the movement from 0,20 to 0,200 and back work?  
Is 95,106 in the correct direction from 0,0 ?

```
       {0}

```

1. ;–START GCODE–

M104 S{material\_print\_temperature\_layer\_0} ; Set Extruder temperature  
M140 S{material\_bed\_temperature\_layer\_0} ; Set Heat Bed temperature  
M190 S{material\_bed\_temperature\_layer\_0} ; Wait for Heat Bed temperature  
M109 S{material\_print\_temperature\_layer\_0} ; Wait for Extruder temperature  
G28 ; Home all axes  
M117 Purge extruder  
G92 E0 ; Reset Extruder  
G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed  
G1 X0.1 Y20 Z0.3 F5000.0 ; Move to start position  
G1 X0.1 Y200.0 Z0.3 F1500.0 E15 ; Draw the first line  
G1 X0.4 Y200.0 Z0.3 F5000.0 ; Move to side a little  
G1 X0.4 Y20 Z0.3 F1500.0 E30 ; Draw the second line  
G92 E0 ; Reset Extruder  
G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed

;–END OF START GCODE–

1. G1 F1800 X95.23 Y106.61 Z0 E0
2. G1 F1800 X95.21 Y105.17 Z0 E1.44
3. G1 F1800 X91.36 Y108.15 Z0 E6.31

Are you sure that your machine can handle the 1. / 2. etc. in front of you G1 code?

---

<div class="post-metadata">

**Author:** ![Leblond](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/leblond/32/456655_2.png) [@Leblond](https://discourse.mcneel.com/u/Leblond)\
**Post date:** [January 20, 2023, 1:17pm UTC](https://discourse.mcneel.com/t/grasshopper-gcode-to-3d-printing/153592/3 "2023-01-20T13:17:08Z")

</div>

Thank you @JoergH 😃

Could you tell me how to internalise the file into Grasshopper ?  
I’m printing on a cartesian printer (Ender3). The x,y 0,0 is located on the on the lower left corner.  
The build plate’s dimensions are 235 x 235 mm.

It is what I see when I upload the file in NcViewer:

 ![Capture d’écran 2023-01-20 à 14.14.27](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/e/5/1/e51c3674ac9532b197468f5dcd8d0279653f8004.png)

But this is what I have when I upload the file in Cura:

 ![Capture d’écran 2023-01-20 à 14.15.50](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/1/2/3/123e3e30e5b1b948e5a57b25f3c2df32e8bd4b4d.jpeg)

---

<div class="post-metadata">

**Author:** ![JoergH](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/joergh/32/590938_2.png) [@JoergH](https://discourse.mcneel.com/u/JoergH)\
**Post date:** [January 20, 2023, 1:45pm UTC](https://discourse.mcneel.com/t/grasshopper-gcode-to-3d-printing/153592/4 "2023-01-20T13:45:20Z")

</div>

In ncviewer you watch at a 3d view. The line from 0,20 to 0,200 is in y direction, so the views seem to be identical to cura. If the 0,20 to 0,200 and back works, I would try to remove the line numbering like:

1. G1 F1800 X95.23 Y106.61 Z0 E0
2. G1 F1800 X95.21 Y105.17 Z0 E1.44
3. G1 F1800 X91.36 Y108.15 Z0 E6.31
4. G1 F1800 X90.28 Y108.79 Z0 E7.57
5. G1 F1800 X89.11 Y109.13 Z0 E8.78

to  
G1 F1800 X95.23 Y106.61 Z0 E0  
G1 F1800 X95.21 Y105.17 Z0 E1.44  
G1 F1800 X91.36 Y108.15 Z0 E6.31  
G1 F1800 X90.28 Y108.79 Z0 E7.57  
G1 F1800 X89.11 Y109.13 Z0 E8.78

to internalise the curve in GH, just right click on the curve node and choose internalise data.  
Please remove the svg import, so we don´t have to install add ons…  
Arcs should normally be G2 / G3, but you are only producing G1…

---

<div class="post-metadata">

**Author:** ![Leblond](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/leblond/32/456655_2.png) [@Leblond](https://discourse.mcneel.com/u/Leblond)\
**Post date:** [January 20, 2023, 1:48pm UTC](https://discourse.mcneel.com/t/grasshopper-gcode-to-3d-printing/153592/5 "2023-01-20T13:48:42Z")

</div>

How could I change the Arcs setting through my file ? (Im new to grasshopper)

Here it is - let me know if it is working for you:  
[2D\_pattern.gh](https://discourse.mcneel.com/uploads/short-url/l4UjaAQCYouu4kY8URrwzoslZig.gh) (20.4 KB)

---

<div class="post-metadata">

**Author:** ![Leblond](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/leblond/32/456655_2.png) [@Leblond](https://discourse.mcneel.com/u/Leblond)\
**Post date:** [January 20, 2023, 2:03pm UTC](https://discourse.mcneel.com/t/grasshopper-gcode-to-3d-printing/153592/6 "2023-01-20T14:03:14Z")

</div>

It is working without the line numbering !  
Instead of extracting “All the components” I only extracted the “Data” of the panel.

---

<div class="post-metadata">

**Author:** ![Leblond](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/leblond/32/456655_2.png) [@Leblond](https://discourse.mcneel.com/u/Leblond)\
**Post date:** [January 20, 2023, 2:39pm UTC](https://discourse.mcneel.com/t/grasshopper-gcode-to-3d-printing/153592/7 "2023-01-20T14:39:42Z")

</div>

I tried printing the file but got a problem regarding extrusion:

 ![IMG_9476](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/d/9/5/d951ab696cb2889fb628f23ce3cd74351873615f.jpeg)

Here is the Gcode:  
[test2\_gcode.txt](https://discourse.mcneel.com/uploads/short-url/noDX0rSpagD2TTbXWC43ikbwmoV.txt) (3.8 KB)

Would you know why it is not extruding while following the path but right before ?

---

<div class="post-metadata">

**Author:** ![JoergH](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/joergh/32/590938_2.png) [@JoergH](https://discourse.mcneel.com/u/JoergH)\
**Post date:** [January 20, 2023, 2:56pm UTC](https://discourse.mcneel.com/t/grasshopper-gcode-to-3d-printing/153592/8 "2023-01-20T14:56:40Z")

</div>

not really, according to your code material should be fed.  
I don´t know your printer, so can´t really help.  
the only difference in g-code I can see is that:

G1 X0.4 Y20 Z0.3 F1500.0 E30 ; Draw the second line

vs

G1 F1800 X95.21 Y105.17 Z0 E1.44

means F is in a different place. And z was 0,3, but is 0 in your code !. Maybe distance between nozzle and plate to small?  
Increase z to 0,3 for all…

---

<div class="post-metadata">

**Author:** ![JoergH](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/joergh/32/590938_2.png) [@JoergH](https://discourse.mcneel.com/u/JoergH)\
**Post date:** [January 20, 2023, 3:10pm UTC](https://discourse.mcneel.com/t/grasshopper-gcode-to-3d-printing/153592/9 "2023-01-20T15:10:44Z")

</div>

You have to add a z transformation at the beginning of your GH file, just in line to the x and y transformation…

---

<div class="post-metadata">

**Author:** ![Leblond](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/leblond/32/456655_2.png) [@Leblond](https://discourse.mcneel.com/u/Leblond)\
**Post date:** [January 20, 2023, 3:15pm UTC](https://discourse.mcneel.com/t/grasshopper-gcode-to-3d-printing/153592/10 "2023-01-20T15:15:20Z")

</div>

Im not sure to understand what you mean… could you show me within my file ?

Thank you for your help 😃

---

<div class="post-metadata">

**Author:** ![Leblond](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/leblond/32/456655_2.png) [@Leblond](https://discourse.mcneel.com/u/Leblond)\
**Post date:** [January 20, 2023, 3:18pm UTC](https://discourse.mcneel.com/t/grasshopper-gcode-to-3d-printing/153592/11 "2023-01-20T15:18:22Z")

</div>

When adding Z0.3 for all, it is what I get:

 ![IMG_9477](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/f/3/6/f36aeea8e0e6a323d9a102511a67d8b08ada79ec.jpeg)  
It seems it is not extruder enough material between each point…

---

<div class="post-metadata">

**Author:** ![JoergH](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/joergh/32/590938_2.png) [@JoergH](https://discourse.mcneel.com/u/JoergH)\
**Post date:** [January 20, 2023, 3:19pm UTC](https://discourse.mcneel.com/t/grasshopper-gcode-to-3d-printing/153592/12 "2023-01-20T15:19:48Z")

</div>

[2D\_patternjgh1.gh](https://discourse.mcneel.com/uploads/short-url/iTCzUnML4YFllkAo7mInG3Vr1t0.gh) (24.9 KB)

---

<div class="post-metadata">

**Author:** ![JoergH](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/joergh/32/590938_2.png) [@JoergH](https://discourse.mcneel.com/u/JoergH)\
**Post date:** [January 20, 2023, 3:31pm UTC](https://discourse.mcneel.com/t/grasshopper-gcode-to-3d-printing/153592/13 "2023-01-20T15:31:12Z")

</div>

Your g-code gives E values for feeding material, but the values look weird, as they are constantly increasing. I would have expected a value based on the distance between G1 coordinates…  
Look in your Ender manual and check what the Feed values should be…

---

<div class="post-metadata">

**Author:** ![Leblond](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/leblond/32/456655_2.png) [@Leblond](https://discourse.mcneel.com/u/Leblond)\
**Post date:** [January 20, 2023, 4:07pm UTC](https://discourse.mcneel.com/t/grasshopper-gcode-to-3d-printing/153592/14 "2023-01-20T16:07:25Z")

</div>

I found out that there is a difference between absolute and relative positioning.  
Thus, It impacts the feeding values…  
However I don’t understand how can I switch from one to the other in Grasshopper…

---

<div class="post-metadata">

**Author:** ![JoergH](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/joergh/32/590938_2.png) [@JoergH](https://discourse.mcneel.com/u/JoergH)\
**Post date:** [January 20, 2023, 5:13pm UTC](https://discourse.mcneel.com/t/grasshopper-gcode-to-3d-printing/153592/15 "2023-01-20T17:13:28Z")

</div>

I have been looking at the Ender page, and that the E value constantly increases seems to be correct. There is a slider in the GH definition, where you can modify the material feed rate. Maybe that needs to be increased.

---

<div class="post-metadata">

**Author:** ![JoergH](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/joergh/32/590938_2.png) [@JoergH](https://discourse.mcneel.com/u/JoergH)\
**Post date:** [January 20, 2023, 5:38pm UTC](https://discourse.mcneel.com/t/grasshopper-gcode-to-3d-printing/153592/16 "2023-01-20T17:38:47Z")

</div>

That would be most likely M82 E Absolute or M83 E Relative.  
But I don´t see a difference between the start code and the gh code, so don´t believe that this is your problem. You can try to add that in the gh script in start code, or simply with a text editor…
