sameer / svg2gcode

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

Allow export/import settings for web UI #22

Closed matopeto closed 2 years ago

matopeto commented 2 years ago

Would be nice to have ability to export custom settings from web UI and import to other machine

sameer commented 2 years ago

Hi matopeto,

This is a good idea, it's been on my mind but haven't had time to get around to implementing it. Optimistically, I plan to work on it and push that out this weekend.

I'm thinking it would be a JSON config file you export/import in the settings menu on the web interface. That same JSON can be used with the CLI and exported by it too.

How does that sound?

matopeto commented 2 years ago

Thank you... "cross platform" JSON solution sounds great :)

sameer commented 2 years ago

Hey matopeto,

Just pushed changes to add support for this. Let me know what you think!

image

image

matopeto commented 2 years ago

Hi @sameer, it looks great

Thanks for keeping my old unsuported pen plotter alive :)

But maybe two little UX things (sorry i don't want to be annoying) but

  1. from button "Import/Export" isn't (for me) clear what will be imported/exported before i click on it

    • Maybe renaming to "Import/Export Settings" would be better
    • Or move the button to the settings window on the top
    1. Is there any documentation how to use the json in the CLI?
sameer commented 2 years ago

Those are both good points, I think moving the import/export button to be in the settings window would make sense.

I have been meaning to add docs for CLI in a wiki page but haven't gotten around to it. It is pretty straightforward

# To import settings
svg2gcode --setings svg2gcode_settings.json input.svg -o output.gcode
# Arguments will override any imported settings (i.e. if circular interpolation is false in config, you can override that to true via a CLI arg)
svg2gcode --setings svg2gcode_settings.json --circular-interpolation true input.svg -o output.gcode
# To export settings (circular interpolation + feedrate)
svg2gcode --circular-interpolation true --feedrate 300 --export svg2gcode_settings.json