svg to/from embroidery converter

Using Inkscape with other software? Talk about it here.
Moini
Posts: 2162
Joined: Mon Oct 05, 2015 10:44 am

Re: svg to/from embroidery converter

Postby Moini » Sat Nov 11, 2017 3:29 am

The extension doesn't get to interact with the user directly, present dialogs, add new tools to the interface, etc.


That's possible, though. If you only target Linux users, you can use Zenity to ask the user questions. There is an extension that makes use of this. Might even work with Tkinter or similar on both OSes.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

lexelby_
Posts: 9
Joined: Fri Nov 10, 2017 11:14 am

Re: svg to/from embroidery converter

Postby lexelby_ » Sat Nov 11, 2017 10:51 am

Shapely 1.6 should be fine, but I can see right away what I think the problem is: networkx 2.0. It looks like I'm using 1.11, and 2.0 is a major new version with an entirely new API. Try downgrading to 1.11 -- meanwhile I'll see what I can do to make my code work with both. Sorry about that!

Wow, the pre-packaged Inkscape sounds like a great idea. It's especially good because I use libembroidery from Embroidermodder2 to convert to PES format, so that should be packaged in too. I'm going to jump over and create an account on inkscapecommunity.com. Let's continue the discussion there.

lexelby_
Posts: 9
Joined: Fri Nov 10, 2017 11:14 am

Re: svg to/from embroidery converter

Postby lexelby_ » Sat Nov 11, 2017 11:19 am

Well, that was easier than I thought. My latest commit fixes compatibility with networkx 2.0 while still working with 1.11: https://github.com/lexelby/inkscape-embroidery. @ha1fosse, it'd be really awesome if you could give it a go and let me know if it works for you. :)

Still waiting for my account on inkscapecommunity.com to be approved.

lexelby_
Posts: 9
Joined: Fri Nov 10, 2017 11:14 am

Re: svg to/from embroidery converter

Postby lexelby_ » Sat Nov 11, 2017 11:22 am

brynn wrote:Fyi, another new embroidery extension is apparently under development. You can follow the discussion in this mailing list archive thread: https://sourceforge.net/p/inkscape/mail ... /34888776/

I don't know the particulars about it, but you might want to communicate with the author, and potentially collaborate?


I've actually already had a chat with him on that same list, around a month or two ago. We're both approaching what we're doing in different ways, and I'm not sure if they're compatible, but there seemed to be some mutual interest, each of us in what the other is doing. :)

His approach uses a Live Path Effect (LPE). Nifty idea, and opens the door for perhaps a bit more integration with the user, but my C++ is pretty rusty, so I likely wouldn't be able to contribute much.

lexelby_
Posts: 9
Joined: Fri Nov 10, 2017 11:14 am

Re: svg to/from embroidery converter

Postby lexelby_ » Sat Nov 11, 2017 11:25 am

Moini wrote:
The extension doesn't get to interact with the user directly, present dialogs, add new tools to the interface, etc.


That's possible, though. If you only target Linux users, you can use Zenity to ask the user questions. There is an extension that makes use of this. Might even work with Tkinter or similar on both OSes.


Oh sure, and that's exactly what I do with the "Embroidery > Params" extension included in my repo, although I use a full-blown GUI written with wxpython. The thing is, you still can't interact with what the user is actually doing in inkscape's editing window; you only get to pop up dialogs when they run the extension. I've worked around that limitation to a great degree, but the limitation is still there and it's what prevents this from acting just like a commercial standalone embroidery tool.

On the other hand, we get all the amazing power of inkscape, so for my purposes, I'm willing to sacrifice :)

Moini
Posts: 2162
Joined: Mon Oct 05, 2015 10:44 am

Re: svg to/from embroidery converter

Postby Moini » Sat Nov 11, 2017 11:50 pm

Yes, the 'add new tools' part (there's been some development on C++ plugins, though, that are meant to fill that gap) and on-canvas interaction is not possible - but it sounds good, what you've done so far! :D
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

User avatar
brynn
Posts: 9585
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: svg to/from embroidery converter

Postby brynn » Mon Nov 13, 2017 12:57 am

Still waiting for my account on inkscapecommunity.com to be approved.


lexelby_, please look for private message.

User avatar
ha1flosse
Posts: 154
Joined: Wed Oct 21, 2009 8:12 pm
Contact:

Re: svg to/from embroidery converter

Postby ha1flosse » Tue Nov 14, 2017 9:43 am

thanks lexelby, the extension is working now.

i've been checking the functionality, it's verrryyy cool already for smaller patches. the workflow is a bit rough but the result is pretty nice! i had several issues exporting multiple objects and error messages from the shapely module, but exporting them piece by piece is already stable enough to work with. i've been calculating the svg with standard values except satin spacing is a little bit smaller. after converting the pieces with libembroidery and putting them together with the free wilcom-truesizer, it's a nice patch thanks to your extension! maybe you will test - stitch it if you like.

Image

regarding the embroidery-package of inkscape with your extension, we could build a .deb - package with the help of some nice people i've been talking to lately. i will ask brynn to open a development thread at inkscapecommunity as soon as we can be sure the .deb package with your extension will be possible for ubuntu/linux. on windows it seems to be difficult to put the dependencies together, so maybe you have an idea how to build a windows package. most users interested in embroidery use a win pc i think.

lexelby_
Posts: 9
Joined: Fri Nov 10, 2017 11:14 am

Re: svg to/from embroidery converter

Postby lexelby_ » Tue Nov 14, 2017 11:09 am

Nifty! Yeah, I know the workflow is a little bit rough. I've made huge leaps since the original workflow, but it could still use some work, and of course there are the limitations that inkscape imposes on extensions. :)

Nice snowperson! If you'd like to share shapely errors here, I can try to help you debug. There are some situations that raise errors that I haven't yet wrapped in a nice explanation.

Honestly, I can't really help with windows packaging at all. I'm definitely much better at Linux than windows. I've done a lot of .deb package creation in the past, so I can possibly help out there, although my free time is rather limited lately.

User avatar
ha1flosse
Posts: 154
Joined: Wed Oct 21, 2009 8:12 pm
Contact:

Re: svg to/from embroidery converter

Postby ha1flosse » Tue Nov 14, 2017 8:50 pm

lexelby_ wrote:Nifty! Yeah, I know the workflow is a little bit rough. I've made huge leaps since the original workflow, but it could still use some work, and of course there are the limitations that inkscape imposes on extensions. :)


the progress of development is huge! i've been trying the extension from stesie, but it was far from usable. yours is pretty versatile! it closes a huge gap between expensive commercial tools and the available free tools for embroidery. great work!

lexelby_ wrote:Nice snowperson! If you'd like to share shapely errors here, I can try to help you debug. There are some situations that raise errors that I haven't yet wrapped in a nice explanation.


thanks! i had several errors calculating the whole svg at once. the svg is avaiable on openclipart.org, the version without outlines is the one i've been using for the embroidery - template. maybe you want to check the errors yourself. calculating the svg part by part worked although.

lexelby_ wrote:Honestly, I can't really help with windows packaging at all. I'm definitely much better at Linux than windows. I've done a lot of .deb package creation in the past, so I can possibly help out there, although my free time is rather limited lately.


coo! so we should built a .deb with all dependencies in one package. i can't contribute much to the process, i don't know pretty much about building packages. is the integration of libembroidery-convert in the .deb possible, so users can access it via inkscape and a small dialog vor converting the csv? unfortunately a lot of users are still on windows, but its also a good point to have a look at ubuntu if they want to use your extension.

Moini
Posts: 2162
Joined: Mon Oct 05, 2015 10:44 am

Re: svg to/from embroidery converter

Postby Moini » Wed Nov 15, 2017 7:45 am

Been looking into it, after ha1flosse asked me for help, and after some consideration, I think a .deb is not the ideal way to go. A simple install script that sets it all up will suffice, and it will not interfere with any existing Inkscape installations (i.e. it will not install a second Inkscape that would have to be started via a bash script to set the environment variables correctly).

Can someone please confirm if these packages for Ubuntu 16.04 from official repositories meet the requirements for the extension:

python-wxtools
python-shapely
python-networkx

If they don't, I'd go with pip instead (or load from whichever source is being suggested instead), but using official package management would be preferred.

(also, I'd add the 0.92.2 ppa, or even the 0.92.x one, which fixes some bugs whenever a fix is backported)
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

Moini
Posts: 2162
Joined: Mon Oct 05, 2015 10:44 am

Re: svg to/from embroidery converter

Postby Moini » Wed Nov 15, 2017 7:47 am

(writing that script is a 3minute job, and will serve people better)
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

User avatar
ha1flosse
Posts: 154
Joined: Wed Oct 21, 2009 8:12 pm
Contact:

Re: svg to/from embroidery converter

Postby ha1flosse » Wed Nov 15, 2017 8:47 am

cool, a script is nice! i can confirm these are the needed packages.

Moini
Posts: 2162
Joined: Mon Oct 05, 2015 10:44 am

Re: svg to/from embroidery converter

Postby Moini » Wed Nov 15, 2017 12:43 pm

Just read lexelby's instructions, seems we need pip.
lexelby_ , could you add a (open source) licence to your repository, please? Then I could make a merge request for my script.

ha1flosse, if you like, you can test it on a new Ubuntu (copy into a file, e.g. setup_ink_embroider.sh, then run the script with 'sh setup_ink_embroider.sh'). You'll get the stable-daily branch, though, if you don't want that, remove the '-daily' part. The script will ask you for your password, to be able to install stuff.

Might be there are issues if default Python is Python 3, and not 2 - please test.

It doesn't (yet?) automate the setup for the embroidermodder. It's too late for that today.

Code: Select all

#!/bin/bash

# we want to be in the tmp directory
cd /tmp

# delete old snap Inkscape (we really don't want a snap!)
sudo snap remove inkscape

# add stable-daily repository
sudo add-apt-repository ppa:inkscape.dev/stable-daily

# refresh package list
sudo apt-get update

# install everything we need
sudo apt-get install inkscape pip unzip

# download lexelby's embroidery extension
wget https://github.com/lexelby/inkscape-embroidery/archive/master.zip

# unzip files
unzip master.zip -d /tmp

# change into new directory
cd inkscape-embroidery-master

# install requirements (only with user privileges, not system-wide)
pip install --user -r requirements.txt

# create extensions directory if doesn't exist yet
mkdir -p $HOME/.config/inkscape/extensions

# copy all *.py and *.inx files there
cp *.py *.inx $HOME/.config/inkscape/extensions

echo "Lexelby's embroidery extension has been installed, and your Inkscape version is now on the stable daily branch."
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

lexelby_
Posts: 9
Joined: Fri Nov 10, 2017 11:14 am

Re: svg to/from embroidery converter

Postby lexelby_ » Thu Nov 16, 2017 2:20 pm

Ooh, I like the script idea. Thanks!

Moini wrote:Just read lexelby's instructions, seems we need pip.
lexelby_ , could you add a (open source) licence to your repository, please? Then I could make a merge request for my script.


That's... a bit tricky. I'm happy to release my contributions, but I believe there are some contributors who have not indicated licenses for their work (stesie for example). We'll have to chase them up before we can slap a LICENSE file on this.

In fact, technically jonh only put a license (GPLv3) on embroider.py, not the .inx or PyEmb.py. Kind of a mess. :/

Might be there are issues if default Python is Python 3, and not 2 - please test.


I can fully guarantee that this extension will not run in python 3 as it stands ;)

Why do we want the script to install the daily build version of inkscape? For non-tech-savvy users, the daily build is risky because they may not know how to upgrade it. I've tested with the latest stable release (0.92.2), so perhaps we should go with that?

I'm thinking the best way to handle embroidermodder would be to debianize it, or at least libembroidery. I unfortunately don't have the time to put into that at the moment, though.

lexelby_
Posts: 9
Joined: Fri Nov 10, 2017 11:14 am

Re: svg to/from embroidery converter

Postby lexelby_ » Thu Nov 16, 2017 2:29 pm

ha1flosse wrote:the progress of development is huge! i've been trying the extension from stesie, but it was far from usable. yours is pretty versatile! it closes a huge gap between expensive commercial tools and the available free tools for embroidery. great work!


Thank you! I'm really happy to hear that you find it useful.

thanks! i had several errors calculating the whole svg at once. the svg is avaiable on openclipart.org, the version without outlines is the one i've
been using for the embroidery - template. maybe you want to check the errors yourself. calculating the svg part by part worked although.


I wouldn't recommend loading up just any old SVG file and running my extension on it. That's definitely not how I intend it to be used, and it's likely that the errors you're seeing are from perfectly acceptable SVG things that my extension can't handle. Examples that will definitely blow it up: paths containing multiple separate filled-in regions and paths that self-intersect.

I really see the SVG as less of a picture of what I want embroidered and more of a set of instructions. By the time I've finished preparing a design SVG, it only moderately resembles the original image I based it on. At some point when I have a chance, I'll see if I can include an example SVG in the repo along with an explanation of how it all fits together.

coo! so we should built a .deb with all dependencies in one package. i can't contribute much to the process, i don't know pretty much about building packages. is the integration of libembroidery-convert in the .deb possible, so users can access it via inkscape and a small dialog vor converting the csv? unfortunately a lot of users are still on windows, but its also a good point to have a look at ubuntu if they want to use your extension.


I'm with Moini: I don't think we should be packaging a special version of inkscape. On the other hand, packaging my extension as a .deb could work great: it could depend on inkscape (and thus cause it to be installed if it's not already) and install my extension's files in /usr/share/inkscape/extensions. If we packaged libembroidery (from embroidermodder) as a separate .deb, we could have my extension depend on that, too. Stick it all in a PPA and it'd be a super-simple install for Ubuntu users, potentially point-and-click.

Oh, we'd probably also have to package up newer versions of shapely and networkx. My script definitely depends on at least one feature of the latest version of shapely.

User avatar
ha1flosse
Posts: 154
Joined: Wed Oct 21, 2009 8:12 pm
Contact:

Re: svg to/from embroidery converter

Postby ha1flosse » Fri Nov 17, 2017 5:17 am

lexelby_ wrote:I wouldn't recommend loading up just any old SVG file and running my extension on it. That's definitely not how I intend it to be used, and it's likely that the errors you're seeing are from perfectly acceptable SVG things that my extension can't handle. Examples that will definitely blow it up: paths containing multiple separate filled-in regions and paths that self-intersect.

I really see the SVG as less of a picture of what I want embroidered and more of a set of instructions. By the time I've finished preparing a design SVG, it only moderately resembles the original image I based it on. At some point when I have a chance, I'll see if I can include an example SVG in the repo along with an explanation of how it all fits together.


i understand that and i have to apologize, i was just running it with standard values to test it without further investigating what causes the errors. exporting the svg part by part worked in the testrun and that was all right for the moment. nice to hear that it was me - the user - that caused the issues, not the extension.

a ppa would be great for all ubuntu users! is there a chance for a solution on windows?

Moini
Posts: 2162
Joined: Mon Oct 05, 2015 10:44 am

Re: svg to/from embroidery converter

Postby Moini » Fri Nov 17, 2017 6:31 am

Your ideas sound very good, lexelby :)
Would you try and contact stesie and jonh about the licences?
I'm not currently interested in learning on my own how to put up a ppa and how to package software the correct way (I'm a checkinstall user... :P). I think launchpad provides a tool chain for that that automates a big part of the process, but I've never looked at it.

The only issue that users may encounter might be an existing snap install of Inkscape, which needs to be removed before any other installation would work - snap has precedence in the PATH... :-/ So even if Inkscape stable is installed via package management, the snap Inkscape would be started when you use the 'inkscape' command, and it would not use any extensions in /usr/share (as far as I can imagine).

Meanwhile, scripting seems a good enough bridging technique, until one of us can muster the time for another option, even if it installs lots of stuff that won't be needed after the installation anymore. That's something I can manage on my own - perhaps then ha1flosse will finally come and give a talk about open source embroidery workflows at our yearly conference in Kiel :)

@ha1flosse: no idea :) The installation could probably be scripted on Windows, too - but I can't help with Win command line, and I have no idea if the additional embroidermodder thing even works on Windows (nor would I know how to compile).
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

lexelby_
Posts: 9
Joined: Fri Nov 10, 2017 11:14 am

Re: svg to/from embroidery converter

Postby lexelby_ » Sun Nov 19, 2017 6:30 am

Actually, after reading the GPLv3 carefully, it turns out there's no need to contact either stesie or jonh. Jonh released the entire code under GPLv3 (http://www.jonh.net/~jonh/inkscape-embroidery/) and therefore any modifications are also automatically released under GPLv3. I've added the appropriate LICENSE file to master.

Moini
Posts: 2162
Joined: Mon Oct 05, 2015 10:44 am

Re: svg to/from embroidery converter

Postby Moini » Sun Nov 19, 2017 8:45 am

Perfect :D Thanks!
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)


Return to “Inkscape & other”

Who is online

Users browsing this forum: No registered users and 2 guests