Ultimaker / CuraEngine

Powerful, fast and robust engine for converting 3D models into g-code instructions for 3D printers. It is part of the larger open source project Cura.
https://ultimaker.com/en/products/cura-software
GNU Affero General Public License v3.0
1.7k stars 887 forks source link

Gcode contains "M104 S{material_print_temperature}" #470

Open terryspitz opened 7 years ago

terryspitz commented 7 years ago

I'm using the following command line on Windows 10: "C:\Program Files\Cura 2.4\CuraEngine.exe" slice -j "c:\Program Files\Cura 2.4\resources\definitions\prusa_i3_mk2.def.json" -l Marvin.stl -o Marvin.gcode

Output gcode has duplicate M104 and it doesn't set the temperatures properly on my Prusa Mk2.

;FLAVOR:RepRap
;TIME:6666

;Generated with Cura_SteamEngine 2.3.1
M190 S55
M104 S210
M109 S210
G21 ; set units to millimeters
G90 ; use absolute positioning
M82 ; absolute extrusion mode
G28 W ; home all without mesh bed level
G80 ; mesh bed leveling
M104 S{material_print_temperature} ; set extruder temp
M140 S{material_bed_temperature} ; set bed temp
M190 S{material_bed_temperature} ; wait for bed temp
M109 S{material_print_temperature} ; wait for extruder temp
G92 E0.0 ; reset extruder distance position
G1 Y-3.0 F1000.0 ; go outside print area
G1 X60.0 E9.0 F1000.0 ; intro line
G1 X100.0 E21.5 F1000.0 ; intro line
G92 E0.0 ; reset extruder distance position
;LAYER_COUNT:278

whereas GUI generated gcode starts:

;FLAVOR:RepRap
;TIME:5494
;Generated with Cura_SteamEngine 2.3.1
G21 ; set units to millimeters
G90 ; use absolute positioning
M82 ; absolute extrusion mode
G28 W ; home all without mesh bed level
G80 ; mesh bed leveling
M104 S215 ; set extruder temp
M140 S55 ; set bed temp
M190 S55 ; wait for bed temp
M109 S215 ; wait for extruder temp
G92 E0.0 ; reset extruder distance position
G1 Y-3.0 F1000.0 ; go outside print area
G1 X60.0 E9.0 F1000.0 ; intro line
G1 X100.0 E21.5 F1000.0 ; intro line
G92 E0.0 ; reset extruder distance position
;LAYER_COUNT:462
BagelOrb commented 7 years ago

The auto-replacement of settings in the start_gcode is a frontend feature - it doesn't work when you use the command line directly.

We at Ultimaker are probably not going to do this, because none of our printers have such settings in the start_gcode and we don't really use the command line tool in that way.

We do allow pull requests, if you really want this to work, though.

Note that while the frontend uses the "value" function in order to determine the value of a setting, the engine only uses "default_value", so you might get different settings when you slice via the command line.