I found the hpgl_output extension in one of the development versions, and modified it to work properly with my Roland CAMM-1 vinyl cutter
camm-gl.inx
<inkscape-extension>
<_name>CAMM-GL</_name>
<id>org.ekips.output.camm-gl</id>
<dependency type="extension">org.inkscape.output.svg.inkscape</dependency>
<dependency type="executable" location="extensions">camm-gl.py</dependency>
<dependency type="executable" location="extensions">inkex.py</dependency>
<output>
<extension>.plt</extension>
<mimetype>image/camm-gl</mimetype>
<_filetypename>CAMM-GL (*.plt)</_filetypename>
<_filetypetooltip>CAMM-GL</_filetypetooltip>
<dataloss>TRUE</dataloss>
</output>
<script>
<command reldir="extensions" interpreter="python">camm-gl.py</command>
<helper_extension>org.inkscape.output.svg.inkscape</helper_extension>
</script>
</inkscape-extension>
camm-gl.py
#!/usr/bin/env python
'''
Copyright (C) 2005,2007 Aaron Spike, [email protected]
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
'''
import inkex, cubicsuperpath, simplepath, cspsubdiv, sys
class MyEffect(inkex.Effect):
def __init__(self):
inkex.Effect.__init__(self)
self.OptionParser.add_option("-f", "--flatness",
action="store", type="float",
dest="flat", default=.2,
help="Minimum flatness of the subdivided curves")
self.plt = ['IN;PA0,0;VS5;']
def output(self):
print ''.join(self.plt)
def effect(self):
sys.setrecursionlimit(7500)
path = '//svg:path'
for node in self.document.getroot().xpath(path, namespaces=inkex.NSS):
d = node.get('d')
p = cubicsuperpath.parsePath(d)
cspsubdiv.cspsubdiv(p, self.options.flat)
for sp in p:
first = True
for csp in sp:
cmd = 'PD'
if first:
cmd = 'PU'
first = False
self.plt.append('%s%d,%d;' % (cmd,csp[1][1]*1016/90,csp[1][0]*1016/90))
self.plt.append('PU0,0;')
e = MyEffect()
e.affect()
A few remarks on some of the changes:
dest="flat", default=.2 origional setting produced really rough ugly curves
'IN;PA0,0;VS5; changed initiallization string, VS5 slows down the cutter and improves quality--bad teflon strip and dull blades really suck
sys.setrecursionlimit(7500) the extension bombs on curve subdivision sometimes because of the .2 flat setting, may need
'%s%d,%d;' % (cmd,csp[1][1]*1016/90,csp[1][0]*1016/90)) changed to the %d to get whole numbers, swapped x and y axis, fixed scale so 1 inch in inkscape is 1 inch on vinyl cutter
'PU0,0; return the cutter to origin after cut.
The resulting plt file can be sent to the cutter with Roland's Dropout utility and the Windows print driver. copy test.plt com1: doesn't work. A PNC-950 apparently doesn't have any buffering, copy doesn't wait on flow control, and the cutter jumps all over the place from corrupt data. I put together a .Net 3 Visual Basic program that renders the plt and sends it to the cutter. I don't have anywhere to host it right now, but I'll email it to anyone who is interested.
This is far better than any previous attempt I've done. My origonal conversion program worked really well except for arcs, and I couldn't find a good solution. A posting on launchpad sent me looking for the hpgl extension, and the answer to my problems. Hope it does someone else some good.
I really want the script to check if a layer is visible or not before exporting
Modified hpgl_output extension for vinyl cutter...
Re: Modified hpgl_output extension for vinyl cutter...
You should post this as a bug report on Launchpad if you would like it to be included in future releases of Inkscape.
You can check the 'display' property: "inline" is the usual value, "none" means hidden. The module simplestyle.py in the extensions directory may be helpful for doing this.
kmitchell wrote:I really want the script to check if a layer is visible or not before exporting
You can check the 'display' property: "inline" is the usual value, "none" means hidden. The module simplestyle.py in the extensions directory may be helpful for doing this.