aligator / GoSlice

This is an experimental slicer for 3d printing written in Go also usable as modular slicing lib.
Apache License 2.0
99 stars 16 forks source link

configurable start and end gcode #17

Closed aligator closed 2 years ago

aligator commented 4 years ago

Currently the start and end gcode is hard coded here.

It would be great to have a configurable start and end gcode. For now it would be enough to just use two string-options which are just injected into the gcode.

kpfaulkner commented 4 years ago

Is this in regard to the non instruction messages? ie.

"Generated with GoSlice" "__"

Just want to be able to customise it?

aligator commented 4 years ago

I think this should be left hardcoded as a sort of branding.

b.AddComment("Generated with GoSlice") b.AddComment("__")

With this issue I meant this block:

        // starting gcode
        b.AddComment("START_GCODE")
        b.AddCommand("G1 X0 Y20 Z0.2 F3000 ; get ready to prime")
        b.AddCommand("G92 E0 ; reset extrusion distance")
        b.AddCommand("G1 X200 E20 F600 ; prime nozzle")
        b.AddCommand("G1 Z5 F5000 ; lift nozzle")
        b.AddCommand("G92 E0 ; reset extrusion distance")

and for the ending gcode this:

        b.AddComment("END_GCODE")
        b.SetExtrusion(options.Print.LayerThickness, options.Printer.ExtrusionWidth, options.Filament.FilamentDiameter)
        b.AddCommand("M107 ; disable fan")

        // disable heaters
        b.AddCommand("M104 S0 ; Set Hot-end to 0C (off)")
        b.AddCommand("M140 S0 ; Set bed to 0C (off)")
kpfaulkner commented 4 years ago

Should something like setting temperatures be something purely user defined? For safety shouldn't that always be executed? (yes, there is the argument about user knows what they're doing... but it would be easy enough to miss).

aligator commented 4 years ago

Good point, but I am more a fan of customizability and good defaults.

Another way would be something like an additional flag "ForceSafeDisable" or something like that which is set to true as default and adds the safe gcode after the custom gcode. It would be a bit more complicated but maybe a good compromis...

What do you think?

galamdring commented 2 years ago

Would you add the flag and custom code to PrinterOptions or GoSliceOptions? I'm thinking printer options makes sense if the future state includes profiles for different printers.

aligator commented 2 years ago

Hi :-) I also think that PrinterOptions is better, because in most cases it is printer specific.

Just a note for you: I am planning to change the license. So if you contribute, make sure you are also ok with the new license (Apache 2). I only need one missing agreement to finally change it: https://github.com/aligator/GoSlice/issues/44