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

simple temperature gcode #9

Closed aligator closed 4 years ago

aligator commented 4 years ago

add simple gcodes for the temperature:

For both, hotend and heated bed.

https://marlinfw.org/docs/gcode/M104.html https://marlinfw.org/docs/gcode/M109.html https://marlinfw.org/docs/gcode/M140.html https://marlinfw.org/docs/gcode/M190.html

Also turn them off at the end.

masihtehrani commented 4 years ago

@aligator I'd like to work on it can you more explain about the issue

aligator commented 4 years ago

Great, currently I have no temperature commands at all. The plan is to have a M109 and M190 command in the starting GCode which sets (and waits for) a target temperature (which should be configurable).

Then after it reaches a (configurable) layer, it should use the M104 and M140 to set the temperatures for the higher layers. All 4 temperatures should of course also be configurable.

You can also suggest own ideas for temperature handling. Do you have a 3D printer to test if the commands work as expected (haven't tried them yet, just looked them up in the marlin docu)?

To get startet, I suggest you to add the configuration values here: https://github.com/aligator/GoSlice/blob/master/data/option.go

Then you have to inject the GCode. For now I think it's enough to add it to the https://github.com/aligator/GoSlice/blob/master/gcode/renderer/layer.go PreLayer renderer similar to the fan I start there (M106).

The configured values can be obtained there using the options parameter.

If you have any idea for improvements, please create issues :-)

masihtehrani commented 4 years ago

Great, currently I have no temperature commands at all. The plan is to have a M109 and M190 command in the starting GCode which sets (and waits for) a target temperature (which should be configurable).

Then after it reaches a (configurable) layer, it should use the M104 and M140 to set the temperatures for the higher layers. All 4 temperatures should of course also be configurable.

You can also suggest own ideas for temperature handling. Do you have a 3D printer to test if the commands work as expected (haven't tried them yet, just looked them up in the marlin docu)?

To get startet, I suggest you to add the configuration values here: https://github.com/aligator/GoSlice/blob/master/data/option.go

  • to the struct (in this case I think the FilamentOptions struct)
  • to the default config
  • to the ParseFlags method

Then you have to inject the GCode. For now I think it's enough to add it to the https://github.com/aligator/GoSlice/blob/master/gcode/renderer/layer.go PreLayer renderer similar to the fan I start there (M106).

The configured values can be obtained there using the options parameter.

If you have any idea for improvements, please create issues :-)

Oh sorry I don't have a 3D printer and I don't have knowledge about this device. I just know Golang. I don't know I can help you on this issue or not

aligator commented 4 years ago

ok, that's no problem. Just try it, I will test it then.

But you may need to learn a bit how GCodes work, it's not that hard, it's basically a simple list of commands.

If you need a viewer for the gcode to check it, I can suggest the Cura slicer. It can also open GCodes and you can configure it to show which temperature is used by colorizing the model. (ok, just tested it, you can't. But you can check it by opening the gcode file in a text editor and search for it.) https://ultimaker.com/de/software/ultimaker-cura

As you have no 3d Printer, I provide you a simple test - model you can use for testing. slice-test.stl.zip unpack it and run go run . --file slice-test.stl to test it.

Then just load the generated gcode file in cura.

If you have questions, just ask.

aligator commented 4 years ago

done by https://github.com/aligator/GoSlice/commit/c3377c69cd0175f3e4cc57d8f08cc55e6cd5b6c2