Grasshopper Gcode to 3D printing

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 (11.0 KB)
test2_gcode.txt (4.5 KB)
ex

Thank you very much !!

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/

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?

Thank you @JoergH :smiley:

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:

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

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…

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 (20.4 KB)

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

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

Here is the Gcode:
test2_gcode.txt (3.8 KB)

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

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…

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

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

Thank you for your help :smiley:

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


It seems it is not extruder enough material between each point…

2D_patternjgh1.gh (24.9 KB)

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…

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…

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.

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…