diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/README.md b/README.md index 1402535..7057650 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,11 @@ # inkscape-papercraft-unfold-stl +This minimal extension unfolds binary STL files into flattened SVG shapes which can be cut by laser, vinyl cutter, milling machine, etc.. It utilizes https://github.com/osresearch/papercraft. +## Installation +Drop all files in your InkScape extension directory (except Test STL/ and README.md). + +##Documentation +Can be found at: https://wiki.fablabchemnitz.de/display/FCT/Papercraft+Unfold+STL + +##Notes +This plugin is also included in https://gitea.fablabchemnitz.de/MarioVoigt/mightyscape \ No newline at end of file diff --git a/Test STL/kuboktaederstumpf.stl b/Test STL/kuboktaederstumpf.stl new file mode 100644 index 0000000..fc0da6e Binary files /dev/null and b/Test STL/kuboktaederstumpf.stl differ diff --git a/fablabchemnitz_papercraft_unfold.inx b/fablabchemnitz_papercraft_unfold.inx new file mode 100644 index 0000000..afd2b7e --- /dev/null +++ b/fablabchemnitz_papercraft_unfold.inx @@ -0,0 +1,15 @@ + + + <_name>Papercraft Unfold + fablabchemnitz.de.papercraft_unfold + fablabchemnitz_papercraft_unfold.py + + .stl + application/sla + <_filetypename>Unfoldable Stereolitography File (*.stl) + <_filetypetooltip>Unfold STL Files + + + \ No newline at end of file diff --git a/fablabchemnitz_papercraft_unfold.py b/fablabchemnitz_papercraft_unfold.py new file mode 100644 index 0000000..7a718f0 --- /dev/null +++ b/fablabchemnitz_papercraft_unfold.py @@ -0,0 +1,46 @@ +''' +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Creator: Mario Voigt / FabLab Chemnitz - Stadtfabrikanten e.V. +''' + +import sys +from subprocess import Popen, PIPE +import subprocess +import inkex +import os +class Unfold: + def __init__(self): + stl_filename = inkex.sys.argv[1] + #inkex.debug("stl_filename: "+stl_filename) + if os.name=="nt": + outname = "papercraft_unfold_output.svg" + #remove old file if existent + if os.path.exists(outname): + os.remove(outname) + if os.path.exists("unfold.exe.stackdump"): + os.remove("unfold.exe.stackdump") + #inkex.debug("os.getcwd(): "+os.getcwd()) + cmd = os.getcwd() + "\\papercraft\\unfold.exe" + " < " + stl_filename + " > " + outname + #inkex.debug("cmd: "+cmd) + p = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE) + inkex.debug(p.communicate()) + p.wait() + if p.returncode == 0: + #inkex.debug("OK") + doc = inkex.etree.parse(os.getcwd() + "\\" + outname) + doc.write(inkex.sys.stdout) +if __name__ == '__main__': + gc = Unfold() \ No newline at end of file diff --git a/papercraft/cygwin1.dll b/papercraft/cygwin1.dll new file mode 100644 index 0000000..6998051 Binary files /dev/null and b/papercraft/cygwin1.dll differ diff --git a/papercraft/unfold.exe b/papercraft/unfold.exe new file mode 100644 index 0000000..a2be5ea Binary files /dev/null and b/papercraft/unfold.exe differ