Open kandrejevs2 opened 2 years ago
Thanks for the report. This is expected behavior. That is the stock Ender 3 StartUp Gcode and it's provided via the Printer Definition file that was submitted to UltiMaker by Creality (or a contributor) for inclusion in Cura.
If there is no mention of temperatures in the StartUp Gcode then Cura adds temperature lines before the StartUp is inserted. It is a safety to prevent cold extrusions. You need to make an adjustment to your StartUp Gcode. I've highlighted the main changes. You can copy and paste this into your Machine Settings. The curly brackets around the keywords like _{material_bed_temperature_layer0} are required so Cura will know to replace the keywords with the actual numbers when the gcode is created. I've added beginning and ending semi-colons so it's easier to read in the gcode file.
; ; Ender 3 Custom Start G-code ; G21 ;Metric units M82 ;Absolute extrusion mode G90 ;Absolute movement mode M220 S100 ;reset feed rate M221 S100 ;reset flow rate G92 E0 ; Reset Extruder G28 ;Home all axes G0 F600 Z5 ;Move up M104 S160 ;Warm up the hot end to below ooze temp M190 S{material_bed_temperature_layer_0} ;Heat the bed to the Initial Layer temperature and wait for it. G29 ; Auto bed leveling G0 F600 Z10 ;Make sure the nozzle is up off the bed. G0 F4500 X0 Y0 ;Move to the left from corner M105 ;report temperatures M109 S{material_print_temperature_layer_0} ;Heat the hot end to the Initial Layer Print Temperature. G0 X0.1 Y25 Z0.3 F5000.0 ; Move to start position G1 F1500 E2 ;Short prime G1 F1500 X0.1 Y200.0 E15 ; Draw the first purge line G0 F5000 X3.0 Y200.0 ; Move to side a little G1 X3.0 Y25 Z0.3 F1500.0 E30 ; Draw the second purge line G92 E0 ; Reset Extruder G1 F1500 E-2 ;short retraction G92 E0 ;Rest Extruder G1 F600 Z15 ; Move Z Axis up G4 S1 ;Wait for one second for the string to harden G0 X3.0 Y35 Z0.35 F5000.0 ; Move to wipe start G0 F3600 X3.0 Y50 ;Wipe the booger off on the purge line G1 F600 Z2 ;Move up for print start ; ; End of StartUp Gcode ;
I'll remove the "Bug" label as what you have there is what was provided by Creality (or a contributor). It would work fine if you didn't have ABL. With ABL it does need to be tweaked.
wouldn't it make more sense to add this code in printer start code dialog rather than just silently adding "pre-start code we though you are forgetting, but we won't ask if it is really what you want" :smiley:
Most people don't know enough about Gcode to make their own changes. They would just dismiss the dialog. Plus, the dialog would come up a lot and be really annoying. Better to just learn the software (and gcode). Competence is the best solution. And remember that when you install a printer it does show the Machine Settings dialog and the startup gcode.
I meant adding heating commands to manage printers -> machine settings -> start G-code dialog and for example indicate error if it lacks temperature commands. it is already pre-populated with G28 and nozzle priming among other things, might as well add temperatures there rather than having undocumented behaviour that adds more code before it if it doesn't meet certain criteria.
If you will install an Ender 3 Pro you will see that the StartUp gcode is written that way. Ultimaker has no idea what the requirements of other manufacturers printers might be. That can't go out and buy one of every printer out there to test them. The stock Ender 3 StartUp Gcode has extrusions in it for the purge lines. I think they were counting on Cura adding the temperature lines so they didn't cause cold extrusions.
The "historical" reason why it is done like it is now is that the heatup sequence is added by CuraEngine (the actual slicer that does the work), and CuraEngine can also be used without the Cura frontend.
I think it would be a good idea to have the Cura dialog detect the absence of a heatup sequence and add a note that a heatup sequence will be added. Then again, that dialog is very cramped to begin with, so I think the gcode snippets should be moved somewhere else (a tabof their own?)
Separate tabs for StartUp Gcode and Ending Gcode could work. When switching to the "StartUp Gcode" tab a check could be run to see if heating commands are in there. If there are none then a popup could inform the user that heating lines will be added prior to the StartUp. With the expanding use of ABL systems it could be helpful. Adding two more tabs might make it a bit more cluttered on a multi-extruder printer though. @fieldOfView Do we have a possible feature request here?
I get the cold extrusion protection. You should be looking for M104/M140 and M109/M190. That does not explain the spurious M82. Why does Cura add this?
M82 ;absolute extrusion mode
before the custom start code. That looks dangerous. You should have that after custom code or M83 if the relative option is check in printer settings. If I use M83 in custom code and don't set it back, does Cura realise?
A bit of investigation (not knowing the software), I find https://github.com/Ultimaker/CuraEngine/blob/cc03a5711c1a28e91cd48c1ffef19dba852b4ca1/src/gcodeExport.cpp#L1018 might be the cause.
It seems to say "ensure absolute extrusion mode" when entering start gcode, but then only sets relative if it is selected. Maybe it should set absolute on entering (which can be reset) and then ensures either relative/absolute as you won't know what mode the custom start gcode left it in.
This particular element is nothing to do with printer profiles - but coding in CuraEngine.
M83 ;last line of starting gcode ; ;End of StartUp ; M83 ;relative extrusion mode > first line after starting gcode
That line is always inserted when in relative mode regardless of what came before. Using that same startup gcode then when using "Absolute Extrusion" an M82 is not added and so the print would start with Absolute E values but in Relative Mode at the printer. BUT as a user I had inserted that line in my StartUp and explicitly stated that I want Relative Extrusion. Personally I am not fond of software that makes decisions for me and I would view it as my fault if the print was a mess.
That line is always inserted when in relative mode regardless of what came before.
Not with Cura 5.2.2. Steps to reproduce (Note this is from Cura 5.2.2, but the root cause is CuraEngine):
Set your custom gcode:
; === BEGIN CUSTOM START GCODE ===
M140 S{material_bed_temperature_layer_0}
M104 S{material_print_temperature_layer_0}
M190 S{material_bed_temperature_layer_0}
M109 S{material_print_temperature_layer_0}
G28
M83; === USE RELATIVE EXTRUSION ===
; ... Insert whatever pre-print gcode you need - like purge lines or whatever
=== END CUSTOM START GCODE ===
Slice and check generated gcode:
;FLAVOR:Marlin
;TIME:1501
;Filament used: 1.01495m
;Layer height: 0.2
;MINX:89
;MINY:89
;MINZ:0.2
;MAXX:131
;MAXY:131
;MAXZ:20
;Generated with Cura_SteamEngine 5.2.2
M82 ;absolute extrusion mode
; === BEGIN CUSTOM START GCODE ===
M140 S60
M104 S205.0
M190 S60
M109 S205.0
G28
M83; === USE RELATIVE EXTRUSION ===
=== END CUSTOM START GCODE ===
G92 E0
G92 E0
G1 F2400 E-0.8
;LAYER_COUNT:100
;LAYER:0
M107
G0 F6000 X92.198 Y92.264 Z0.2
;TYPE:SKIRT
G1 F2400 E0
G1 F1200 X92.886 Y91.627 E0.03119
G1 X93.626 Y91.051 E0.06237
G1 X94.412 Y90.539 E0.09357
G1 X95.239 Y90.097 E0.12476
G1 X96.101 Y89.727 E0.15596
G1 X96.991 Y89.431 E0.18716
G1 X97.903 Y89.213 E0.21835
G1 X98.83 Y89.072 E0.24953
G1 X99.701 Y89.013 E0.27857
G1 X100.33 Y89 E0.29949
...
Note the M82 before custom gcode, the M83 relative extrusion within the cusom gcode and no M82 after custom gcode.
Extrusion mode is left as relative but E values generated indicate absolute.
BUT as a user I had inserted that line in my StartUp and explicitly stated that I want Relative Extrusion. Personally I am not fond of software that makes decisions for me and I would view it as my fault if the print was a mess.
But as a user, I would expect some signal that something may appear before my start gcode and that CuraEngine not assume I have not chosen a local extrusion/coordinate movement for my start gcode purposes.
Would seem reasonable to G90 before custom start code and then either M82/M83 based on what extrusion mode it requires after so you're not dependent on an assumption.
Or even better, not put any "pre-start" statements before the "start" statements - making my custom "start" code be at the "start", instead of "not quite the start". Then add code after if required (like G90, M82 if relative extrusion and M140&M190 to ensure print-start temps.
I kind of agree with both of your views. in current state this management is just a mess. you have some validations, some assumptions that are silently injected at the very beginning which can be then dismissed by user error or otherwise, but in some cases you can't make printer do what you want because there are some undocumented protections going on.
regarding absolute/relative movements and extrusions, that should be part of actual g code and not rely on assumption it is not changed, but otherwise software should not interfere if user f**ks around he should be able to find out.
I just sliced this with 5.2.2. Someone from the Cura team will take a look. ;Generated with Cura_SteamEngine 5.2.2 M82 ;absolute extrusion mode ; ; Greg's E3Pro StartUp ; G90 G21 M82 ;This is in my startup because my purge lines are in Absolute. blah, blah M83 ;I added this just to demonstrate ; ;End of StartUp ; M83 ;relative extrusion mode >Cura put this one in G1 F2100 E-6 ;LAYER_COUNT:250 ;LAYER:0
I just sliced this with 5.2.2. Someone from the Cura team will take a look.
Having two M83 when Cura generates relative extrusion isn't really a problem. Cura wants relative extrusion and asked for it when it was set by custom gcode. For example, there's plenty of redundant G92 E0
reset extruders statements in the file that have no effect.
The real problem is if my custom gcode leaves the machine in relative extrusion and CuraEngine does not reset it back to absolute gcode, but then proceeds to export gcode statements using absolute extrusion E values (because relative extrusion has not been requested).
What should be expected is that after custom gcode, CuraEngine adds either M82/M83 to ensure the extrusion mode is as expected by the rest of the gcode. So it should say:
;
;End of StartUp
;
M82 ;absolute extrusion mode >Cura put this one in
G1 F2100 E-6
;LAYER_COUNT:250
;LAYER:0
Application Version
5.2.1
Platform
Linux ubuntu
Printer
Creality ender 3 v2 neo
Reproduction steps
go to manage printers -> machine settings there is printer start g-code section
slice the model and view the exported Gcode- more code is added to beginning of the file before start code
basically my issue is that after printer does auto bed leveling the nozzle touches the bed as last step of
G29
command. since cura have injected gcode before my start code to heat the bed and the nozzle to the printing temperatures and it causes oozing and a booger of filament is wiped in the center of build plate as last step of ABL routine before priming the nozzle.to prevent this, code that is injected by cura like:
and other lines should be part of actual start code so the user could modify order of execution and fine tune behavior.
Actual results
printer start Gcode
Gcode generated by cura
Expected results
I would expect that start code is the actual start code of the printer and nothing is added to it before.
Checklist of files to include
Additional information & file uploads
otherwise my solution is either to try to clean the booger of the plate while printer does nozzle priming line or I have to modify start code to cancel out preheating right after it has been heated, do the ABL routine and turn back on nozzle heating which adds significant delay to print time.