Duet 3 and g-code procedures and slicing
-
Hi,
I believe that I'm approaching that point where I could do a test print with my old "BFB Touch 3D" printer upgraded by Duet 3 Mainboard 6HC board & Pi.
And I beginning to understand that there are basic things that aren't clear. And that is why I have these question.
- I do have homing process working now. But I absolutely have no idea at what point homing procedure will be happening. It doesn't happen when I switch printer on... Will it happen before each print?
1.1) Does homing happen more then once per print? Is there a chance it will be happening during print somehow? - After homing and before printing there should be some processes going, isn't it? Like extruding some filament for a bit for instance. What g-codes do that?
2.1) Actually when filament extruded I'd like to run head(s) above some nozzle cleaning fence. What code supposed to do that? How do I config this whole process?
2.2) Or is it "home" place where all this things should happen? (I hope not) - Suppose I've done last bits of setup. How exactly do I slice before printing? I mean when using other printers (particularly BFB before upgrade) I had to slice model for some kind of flavor of g-code. Now that it is controlled by Duet 3 what should I know slicing related?
Thank you in advance.
- I do have homing process working now. But I absolutely have no idea at what point homing procedure will be happening. It doesn't happen when I switch printer on... Will it happen before each print?
-
-
up to you, you can put g28 in your config.g file, or you can put it in the start.g file or you can leave it out (the latter will require you to manually home before printing)
-
either start.g or your slicer
but i'm sure someone will elaborate a little on that
-
-
The world is your oyster. You are free to script it out any way you wish.
The axis must be homed before printing obviously. Homing is done with G28. Typically this would be placed in the slicer's start gcode section so that it gets prepended to the start of the gcode file that gets sent to the printer.
Alternatively, you can use
start.g
in the /sys/ folder. This macro gets called by the firmware at the start of every print. You can use it to home the printer, preheat the heaters, etc.Homing isn't normally done during a print, though it would need to happen if trying to recover a print after a power loss.
Doing a prime line will require you to manually craft some gcode commands to do the following in some way:
- heat the hot end
- place the nozzle where you want to prime
- extrude a line of filament over an area
- etc etc
What slicer are you using? If you are coming from a proprietary slicer you may want to look into migrating to PrusaSlicer and/or Cura. Each will have it's own learning curve.
-
@Phaedrux said in Duet 3 and g-code procedures and slicing:
The world is your oyster. You are free to script it out any way you wish.
Problem is that I don't know what to wish Or should wish
That is why I kinda hope that someone shares "best practices" or just some good hintsThe axis must be homed before printing obviously. Homing is done with G28. Typically this would be placed in the slicer's start gcode section so that it gets prepended to the start of the gcode file that gets sent to the printer.
Alternatively, you can use
start.g
in the /sys/ folder. This macro gets called by the firmware at the start of every print. You can use it to home the printer, preheat the heaters, etc.Got it!
Homing isn't normally done during a print, though it would need to happen if trying to recover a print after a power loss.
Can it really recover print after power loss? Wow!
At least my current homing process will for sure hit heads into half printed build. Thinking more of it. Homing Z is more like doomed to crash into something that is on bed as Z end switch is stops homing once bed is close to heads.Doing a prime line will require you to manually craft some gcode commands to do the following in some way:
- heat the hot end
- place the nozzle where you want to prime
- extrude a line of filament over an area
- etc etc
Sorry for not being familiar with terms. I guessed "prime line" means pre-extruding some filament before the print (to get extruder going)?
If yes then - got it
That is something that should be sitting in start.g, right?What slicer are you using? If you are coming from a proprietary slicer you may want to look into migrating to PrusaSlicer and/or Cura. Each will have it's own learning curve.
I'm familiar with Cura - used it several times when printed on Multimaker.
The printer I'm working on now used some own weird/crazy/ugly software which I'd don't wanna see again That is why (mostly) I started the upgrade it first place.
So if I could use Cura - I'd be happy to.
But again, I believe that Cura has a setting for what kind of hardware it making g code for. And that is the question I was asking basically - how to configure slicer to make code suitable for my printer?
In the printer I'm working on there are 3 extruders and of course slicer must have an option to slice taking that into account, right?
I might be saying complete nonsense, sorry if so but I guess Cura printer selection for the reason of building suitable for that hardware g-code, isn't it? That makes me wonder what should be my settings in it...I've actually just now loaded up Cura and there is "Add printer"
I noticed that it doesn't see my network printer even though that on same computer it does access it WebUI. -
@monster said in Duet 3 and g-code procedures and slicing:
I've actually just now loaded up Cura and there is "Add printer"
I noticed that it doesn't see my network printer even though that on same computer it does access it WebUI.Only Ultimaker printers will show up on the network. You will need to create a custom printer entry using your parameters.
There is a plugin for Cura that allows sending the sliced gcode directly to the duet.
Cura does support multiple extruders/tools.
-
@Phaedrux said in Duet 3 and g-code procedures and slicing:
@monster said in Duet 3 and g-code procedures and slicing:
I've actually just now loaded up Cura and there is "Add printer"
I noticed that it doesn't see my network printer even though that on same computer it does access it WebUI.Only Ultimaker printers will show up on the network. You will need to create a custom printer entry using your parameters.
There is a plugin for Cura that allows sending the sliced gcode directly to the duet.
Cura does support multiple extruders/tools.
Ahaa! Got it! Thank you.
Dam... that million of settings in Cura -
Both Cura and SlicerPE have plugins to send g-code directly to a Duet.
In terms of telling the Slicer "which printer", you will find that nobody has built-in profiles for "Duet" because just saying "Duet" that doesn't specify the geometry of the printer.
It takes under five minutes in either slicer to define a custom printer, and key in the dimensions. I have customs in SlicerPE for my big delta (605mm diameter 620 z) and for a "Jubilee" style multi-tool printer, (about 305x305x300) including all the tools. Each took only moments to setup.
-
I've been practicing with Cura.
I still can't get print/simulate directly from Cura. There I added 3 printers
One with http://printer.local address and some name != printer name in WebUI
Another with http://<ip_address> and some name != printer name in WebUI
and another with http://<ip_address> and some name == printer name in WebUIattempt to print/simulate on either gives: There was a network error: 203 Error transferring ....
But I could upload it via WebUI and tried to print without filament - seems heads are moving right way
-
I usually slice with simplify3d and for my start up I have the following in my start script in simplify3d which as you can see carries out numerous functions, this have been working well for a while now.
M290 S0.0 ; clear any baby stepping
G28 ; home all axes
G1 X20 Y50 ; move nozzle to start point
G92 E0 ; zero extruder
G1 Z0.5 ; lower nozzle
G1 Y250 E30 F1200 ; slow wipe
G92 E0 ; zero extruder
G1 Z2 ; lift nozzle
G29 S1 ; load height map -
Here's my start sequence for reference.
start.g
M106 P2 F30000 S0.5 H-1 C"Duet Fans" M140 S65 ; set heated bed to 65 and release T0 ; Select Tool 0 M291 P"Print Started. Preheating and Homing." T10 G4 S1 M98 P"0:/macros/Musical Tunes/LuckyTune.g" ; Lucky tune to start print off on the right foot G4 S1 M220 S100 ; Set speed factor back to 100% in case it was changed M221 S100 ; Set extrusion factor back to 100% in case it was changed M290 R0 S0 ; clear babystepping M106 S0 ; Turn part cooling blower off if it is on G10 P0 R0 S80 ; Set extruder to 80 and release M190 S65 ; set heated bed to 65 and wait G28 ; home XYZ G29 S1 ; load heightmap M400 G10 P0 R80 S180 ; Set extruder to 180 and release M98 P"0:/sys/ZSpeedsPrint.g" ; Load Z speeds for printing M98 P"0:/sys/CurrentsPrint.g" ; Load print motor currents ; Slicer Start Gcode begins.
ZSpeedsPrint.g
; 0:/sys/ZSpeedsPrint.g ; Used to set faster z speeds for printing. M566 Z120 ; Set maximum instantaneous speed changes (mm/min) (Jerk) M203 Z600 ; Set maximum speeds (mm/min) M201 Z240 ; Set maximum accelerations (mm/s^2)
CurrentsPrint.g
; 0:/sys/CurrentsPrint.g ; Used to set normal motor current ; Make sure these values match those in config.g M913 X80 Y80 Z80 E80 ; set X Y Z E motors to 80% of their max current
Slicer start gcode
M98 P"0:/sys/PrimeNozzle.g" M98 P"0:/sys/StartGCode.g"
Primenozzle.g
;M98 P"0:/sys/PrimeNozzle.g" G90 ; Absolute positioning G1 X1 Y270 F6000 ; Move to front left corner M400 ; clear movement buffer M116 ; Wait for temps G1 Z0.3 F100 ; Move Z to prime height G91 ; Relative positioning M83 ; Relative extrusion G1 X40 E10 F300 ; Prime nozzle G10 ; Retract G1 Y-1 X1 F10000 ; Wipe nozzle M400
StartGcode.g
M291 P"Good luck and Godspeed." T5 ; Good luck and Godspeed. ; Battle Cry! ; M400 G4 S1 M300 P200 S523.25 G4 P200 M300 P200 S659.25 G4 P200 M300 P200 S739.99 G4 P250 M300 P285 S880.00 G4 P450 M300 P285 S880.00 G4 P285 M300 P625 S1108.73 G4 S1 M400 ; ; Start the print ;
Slicer End Gcode
M0 ; calls stop.g
Stop.g
; stop.g ; called when M0 (Stop) is run (e.g. when a print from SD card is cancelled) ; Also called by slicer end gcode by M0 ; M400 ; Finish move queue M104 S0 ; Extruder heater off M140 S0 ; Bed heater off M106 S255 ; Fan at 100 to cool nozzle and bed G91 ; Relative positioning M220 S100 ; Set speed factor back to 100% in case it was changed M221 S100 ; Set extrusion factor back to 100% in case it was changed G1 E-2 F9000 ; Retract filament 2mm G1 X5 Y5 F9000 ; Wipe nozzle G1 Z20 F500 ; raise nozzle 5mm from printed part G90 ; absolute positioning G1 X150 Y130 F6000 ; Move x and Y axis over to bed center so probe is on top of bed ;M104 S35 ; Set hot end low and wait G4 S60 ; Wait 5 minutes ;M116 ; wait for temp to drop G28 X Y ; Home X and Y G28 X Y ; Home it again, Sam. M290 R0 S0 ; clear babystepping M84 ; Steppers off M98 P"ZSpeedsNormal.g" ; Load normal z speed settings again. M106 S0 ; Fan off M106 P2 F30000 L0.1 X0.8 B0.5 T35:70 H100:101:102 C"Duet Fans" ;Play a little beep beep beep to show print ended. M400 ; Clear queue again before jingle G4 S1 M300 P250 S750 G4 P251 M300 P200 S1250 G4 P201 M300 P250 S750 G4 P251 M300 P200 S1250 G4 P201 M300 P250 S2500 G4 P251 M300 P150 S2000 G4 P151 M300 P150 S2500 G4 P151 M300 P350 S3700 G4 P351
Doing things this way has a few benefits. Mainly that the slicer start gcode is basically nothing. That way I only have to change the files on the Duet and regardless of which slicer I use the starting and ending behaviour is the same. It also allows me to do a preheat and nozzle prime and still allows the slicer to control the print temps.
-
@Phaedrux Thanks for sharing - that sets the bar...
@Phaedrux said in Duet 3 and g-code procedures and slicing:
M98 P"0:/macros/Musical Tunes/LuckyTune.g" ; Lucky tune to start print off on the right foot
LOL
-
@monster said in Duet 3 and g-code procedures and slicing:
LuckyTune.g
Sorry, I forgot that one.
; 0:/macros/Tunes/LuckyTune.g ; Lucky tune to start print off on the right foot ; M400 ; Empty the movement buffer M300 P200 S1000 G4 P210 M300 P200 S1250 G4 P210 M300 P200 S1100 G4 P201 M300 P200 S2000 G4 P201 M300 P200 S1500 G4 P201 M300 P200 S1000 G4 P201 M300 P200 S1300 G4 P201 M300 P200 S1000 G4 P201 M300 P300 S1500 M400 ; Empty the movement buffer
-
@Phaedrux why do you use M400 often? I actually don't get why emptying of the buffer needed as command cause I though while one movement command is being executed then next command in script will not start. Which in turn means when next command is being executed all the movement of previous one is done. Or do I get some concept wrong? Perhaps movement buffer is not something I picture myself...
-
@Phaedrux said in Duet 3 and g-code procedures and slicing:
Slicer start gcode
Another piece of setup I do not understand fully.
what is "Slicer start gcode"? (as well as "Slicer End Gcode")
Is it some script that defined in slicer software to be included in each g-code to print?
And then "0:/sys/PrimeNozzle.g" & "0:/sys/StartGCode.g" seems located in your printers files system, right? That means your slicer software is counting on presence of those files in printer, correct?
Or is "Slicer start gcode" an another script in printer that being called right before sliced model to be printed?There are so many unknown things here I must admit. For example is there a list of standard scripts like start.g stop.g homex.g etc... that getting called in some occasions?
-
@monster said in Duet 3 and g-code procedures and slicing:
@Phaedrux said in Duet 3 and g-code procedures and slicing:
Slicer start gcode
Another piece of setup I do not understand fully.
what is "Slicer start gcode"? (as well as "Slicer End Gcode")
Is it some script that defined in slicer software to be included in each g-code to print?Got it! It is in printer settings in Cura!
-
@monster said in Duet 3 and g-code procedures and slicing:
@Phaedrux why do you use M400 often? I actually don't get why emptying of the buffer needed as command cause I though while one movement command is being executed then next command in script will not start. Which in turn means when next command is being executed all the movement of previous one is done. Or do I get some concept wrong? Perhaps movement buffer is not something I picture myself...
Probably unnecessary for the most part, done mostly out of habit during troubleshooting. Basically M400 just says wait until the movement queue is complete up to this point before executing what comes after.
For the music bits I found M400 before helped it play the tones more consistently without stutters, but I haven't tested that in quite some time.
-
@monster said in Duet 3 and g-code procedures and slicing:
what is "Slicer start gcode"? (as well as "Slicer End Gcode")
Is it some script that defined in slicer software to be included in each g-code to print?Yes that's right. Most slicers have a section of text boxes that allow you to enter custom gcode commands that will get inserted at certain locations, such as before the print starts, when the print is finished, at layer changes, at tool changes, etc.
Example from PrusaSlicer:
@monster said in Duet 3 and g-code procedures and slicing:
And then "0:/sys/PrimeNozzle.g" & "0:/sys/StartGCode.g" seems located in your printers files system, right?
That's right. M98 allows you to call a macro found on the Duet SD card, either in the macros or sys folder.
@monster said in Duet 3 and g-code procedures and slicing:
For example is there a list of standard scripts like start.g stop.g homex.g etc... that getting called in some occasions?
Yes, there is.
https://duet3d.dozuki.com/Wiki/Setting_up_macro_files_for_common_tasks
https://duet3d.dozuki.com/Wiki/Macros -
@monster said in Duet 3 and g-code procedures and slicing:
There was a network error: 203 Error transferring ....
Apparently Duet3 with SBC does not provide the same API as RepRapFirmware 2 and previous. This means all the slicer integrations are broken - I know of at least PrusaSlicer, and the Cura plugin (I am the maintainer if it).
Looks like once it is RRF that broke compatibility with slicers - usually it is slicers who break magic comments and other things
@dc42 @chrishamm any thoughts on this topic? It would be really nice if the well-known RRF HTTP API with
rr_connect
etc. would also be supported on Duet3+SBC!
It's not only slicers, also lots of other scripts, timelapse tools, and other integrations were relying on this API. -
@Phaedrux said in Duet 3 and g-code procedures and slicing:
@monster said in Duet 3 and g-code procedures and slicing:
For example is there a list of standard scripts like start.g stop.g homex.g etc... that getting called in some occasions?
Yes, there is.
https://duet3d.dozuki.com/Wiki/Setting_up_macro_files_for_common_tasks
https://duet3d.dozuki.com/Wiki/MacrosPriceless!
-
I can't remember where did I read that by now.
But back then when I was choosing controller I did read somewhere that when Duet 3 used with Pi it (or I guess Pi) can do slicing. And if my memory not mistaking that was saying about actually Cura slicer in Pi.Is it something I could try? I mean try to use that slicer.
Hope it is not to difficult to setup and use. May be that could solve my problem...