sameer / svg2gcode

Convert vector graphics to g-code for pen plotters, laser engravers, and other CNC machines
https://sameer.github.io/svg2gcode
MIT License
244 stars 48 forks source link

M2 End of program should be optional #58

Closed tools-for-things-and-ideas closed 1 month ago

tools-for-things-and-ideas commented 1 month ago

As discussed here ( https://github.com/sameer/svg2gcode/issues/23#issuecomment-953073378 ) the appended 'M2' (End of program) is correct. The way the servo on my pen plotter reacts to the M2 is correct too: it moves the servo to the zero-position. In my particular case that's not the best result as it leaves the pen on the paper. I can work around this by making a Gcode post processor or by making the plotter move outside of the paper area in the 'Program End Sequence'. Another solution would be to remake the pen plotter holder so the servo moves the pen up when it's at zero.

Alternatively the SVG2Gcode website could put the M2 in the suggested contents of the Program End Sequence, so people can deactivate it when they would like to. This makes the G-code generation also a bit more transparent, as the resulting G-code would be more predictable. To be clear: this is not a criticism or a bug report. Just a suggestion. I fully understand if there are reasons to keep the website working the way it does now. It's a great tool!

Elias

petervanderwalt commented 1 month ago

image

@sameer could change this setting to overwrite his chosen defaults (enter the M2 etc in the field by default, but allow users to edit it not wanted)

I tried adding my own expecting it to overwrite

image

But sadly that just gets prepended to the M2

image

Not as configurable as the description of the form field "G-Code for stopping/idling the machine at the end of the program" implies if it adds extra gcode after

sameer commented 1 month ago

Alternatively the SVG2Gcode website could put the M2 in the suggested contents of the Program End Sequence, so people can deactivate it when they would like to.

Hey Elias, I think this is a great idea! Thank you for sharing the context around it.

To make this change go smoothly, I'm planning to upgrade the config file in a way that would append M2 to the program end sequence the next time you load the web version of svg2gcode.

On the CLI side, keeping things consistent is a little more tricky. An end sequence in a config file can still have M2 inserted until the format is upgraded. For an end sequence passed as an argument, it won't be obvious that M2 is no longer included. I'll call it out in the release notes.

tools-for-things-and-ideas commented 1 month ago

Hi Sameer,

Thank you for your swift reply! I see it's not a straightforward change. No hurry for the update! Sounds exciting though! Good luck!

sameer commented 1 month ago

This should be fixed by 0c5717f, please refresh the web version and give it a try :slightly_smiling_face:

tools-for-things-and-ideas commented 1 month ago

I did a first test which went great! Thanks for the quick update!

sameer commented 1 month ago

I did a first test which went great! Thanks for the quick update!

No problem! I'll go ahead and close this issue.