inkstitch / pyembroidery

libembroidery/EmbroideryFormats converted to python
MIT License
71 stars 28 forks source link

bCNC compatible Gcode generator and related test integrated #72

Open apshu opened 4 years ago

apshu commented 4 years ago

Hello,

I was improving the hobby machine GCODE output. The new writer plugin improves stitching speed and includes color information. The free bCNC CAM software supports python commands and other extras that help hobby machines. The .ngc formatted file is tested with bCNC.

Please accept the new writer plugin.

https://github.com/vlachoudis/bCNC

Kind regards, Attila

lexelby commented 4 years ago

Awesome, thank you!!

There's a lot in common between this and the existing gcode writer. I wonder if it might make sense to merge them together rather than have two different ones?

Are you using GRBL or another firmware?

apshu commented 4 years ago

Yes, I am using GRBL 1.1.

It is possible to merge the plugin, if you see benefits in this. would you like to merge them and have a setting deciding if legacy GCODE of bCNC backed code should be generated?

Is there a way to transfer settings from Ink/Stitch to the exporter plugin? I have seen the settings are very well defined for all import and export plugin definitions, just couldn't find how to see and change these settings from the Ink/Stitch IDE.

lexelby commented 4 years ago

Yes, I do think merging them is a good idea. There's already a checkbox to enable GRBL's laser mode, so adding another to enable bCNC comments would be great. If I could just get bCNC running on my system, I might be able to test this with my laser cutter. I use it to cut out fabric shapes to use for embroidered patches.

Is there a way to transfer settings from Ink/Stitch to the exporter plugin? I have seen the settings are very well defined for all import and export plugin definitions, just couldn't find how to see and change these settings from the Ink/Stitch IDE.

Yup! Here's how it works. The settings for the gcode output format are defined here. These are in Inkscape's standard INX format.

This is actually a Jinja2 template, so you'll see some extra stuff like this: {{ _("laser mode") }}. That enables the string for internationalization, so we want to use that for any user-facing string.

The name attribute corresponds directly to an entry in the settings dict passed to the writer function. That magic happens here if you're curious. Kind of a bit of a hack but it gets the job done.

When we originally wrote the gcode output format, the person who requested it said to use the .txt file extension, but I think you're right that .ngc or .nc makes much more sense. That was before I had a grbl-based machine of my own, so I didn't know any better. Might as well change it while we're in there.

apshu commented 4 years ago

I was thinking about the merging of the two GCode writers.

The TXT has options for laser and "clean GCODE" The NGC has option for bCNC colors / drill commands.

Both formats has some identical, but many unique options. If we merge these together, the number of options will grow beyond usability for unexperienced users.

Keeping the two modules separated decreases operating complexity.

Please see a little feature teaser :)

sample2 sample1

lexelby commented 2 years ago

Oh, thanks for the reminder! I totally forgot about this. I'll check over what you've done since I last commented.