Page 1 of 1

Inkscape 0.46-0.48 won't vector cut on ULS Laser

Posted: Mon Mar 26, 2012 1:59 pm
by verto50

I've been trying for two years without success to get my ULS Laser cutter to work directly from inkscape.

I've set my path stroke lines to RGB (255,0,0) and line width of 0.003mm all the way to 0.001mm. Yet they always come up rastered in the ULS software after hitting print.

However, if I save a copy as PDF, then print from Adobe Acrobat, the vector lines are correctly shown as cuts and in red.

It's really a big pain to have to export every file to PDF, then open/print it in AA. I've checked all the inkscape settings (printing in Vector mode not raster) and tried every possible combation of stroke widths. For the PDFs, 0.003mm seems to be the best size. According to ULS, anything under 0.005mm (and RED) will be vector cut. Everything else is looked at as a raster. Yet regardless of the line width, I either get a black rastered line or no lines at all (<0.003mm)

ULS says any shape or path set to stroke style of 0.003mm with RGB 255,0,0 should show up as cuts. ULS wasn't much help for inkscape as it works from PDF/corel draw/etc.

Does anyone have some advice?

Re: Inkscape 0.46-0.48 won't vector cut on ULS Laser

Posted: Sun May 06, 2012 2:23 pm
by brynn
Welcome to the forum :D

I'm sorry no one has answered. Maybe my will reply, which will bump your topic back to the top, will get things moving.

I don't think these will help, but just in case, did you see these: viewtopic.php?f=31&t=4987 and viewtopic.php?f=31&t=11496?

Re: Inkscape 0.46-0.48 won't vector cut on ULS Laser

Posted: Mon May 07, 2012 12:56 pm
by verto50
Thanks for the links. Unfortunately, they don't look like they will be helpful for my setup. ULS now says that Inkscape isn't sending vector data to the windows GDI printer interface. Even though the default setting under inkscape is to use vector (not raster) mode. Any ideas from here?

Re: Inkscape 0.46-0.48 won't vector cut on ULS Laser

Posted: Mon May 07, 2012 4:21 pm
by brynn
No, I really have no clue. But I can recommend a nice little forum called Inkscape Cutting Design They have experience with all kinds of different machines, and might know, for example, if a recent upgrade no longer supports Inkscape. I really have no idea what the problem might be, but that is one thing that comes to mind as a possibility.

Or maybe someone else will have an idea :D

Re: Inkscape 0.46-0.48 won't vector cut on ULS Laser

Posted: Sun Jul 01, 2012 4:50 am
by alvinpenner
attached is a proposal to produce a vector graphics printout for Windows. This particular method will work only on Windows, but if I understand the various reports correctly, this rasterization problem occurs only on Windows.

The method is based on the file which has been rewritten to use gdi32.dll for printing. It runs as an Inkscape Python extension from the menu item Extensions->Export->Win32 Vector Print. It will produce a vector output if the linewidth is 1 printer pixel or less. The necessary files are attached here:

Further info is available at comment 12, 13

Since I do not have access to a true laser cutter, any feedback would be more than welcome.


Re: Inkscape 0.46-0.48 won't vector cut on ULS Laser

Posted: Sun Jul 01, 2012 1:28 pm
by brynn
Oh, nice work!
I don't know much about this problem, but I do hope it helps, and look forward to reports of actual use :D

Re: Inkscape 0.46-0.48 won't vector cut on ULS Laser

Posted: Sun Jul 29, 2012 8:48 am
by alvinpenner
fix committed to bzr rev 11575, any testing would be welcome.

Alvin Penner

Re: Inkscape 0.46-0.48 won't vector cut on ULS Laser

Posted: Sat Sep 14, 2013 8:27 am
by Fen_Star
I don't know about your brand of laser cutter but with our (Trotec) cutters line width doesn't matter when printing from inkscape. It only looks at the rgb value and the path. I know that isn't much help, but it does work with some lasers. It also works fine with our vinyl cutter, even though driver support is so bad we have to use it on a 32bit xp machine. It looks like you went through and looked, but on our laser drivers there are all sorts of hidden checkboxes that can mess stuff up.

Re: Inkscape 0.46-0.48 won't vector cut on ULS Laser

Posted: Mon Nov 04, 2013 1:58 pm
by mmunto
I have exactly the same issue when I try to cut with the Laser Cutter Epilog Helix 60 W using Inkscape 0.46. No matter what settings I use that only rasters data, never
cuts and the computer attached only runs in Windows. I can't switch computers or OS because both laser and computer belong to TechShop (company that runs for profit) so I have to use the software they provide (CorelDraw).

Re: Inkscape 0.46-0.48 won't vector cut on ULS Laser

Posted: Thu Nov 07, 2013 12:56 am
by crakkhead
Hi Alvin,
I tried to use the extension with our ULS VersaLaser and while the rasterisation problem is fixed I get one, maybe two different issues.
The dimensions of the objects send to the cutter are squashed in y-direction by about half. So if I send a square with 1 cm long sides I'll end up with a rectangle with 1 cm x 0.5 cm (w x h). The 2:1 ratio is the ratio of the page width to height. I'm not sure if that's the cause, though. I've tried both your extension and the altered version from Eric Gradman in Bug #966244 but the behavior is the same.
The other issue is that there is some scaling going on but I haven't made any investigations into what the factor is and if the alternative version resolves this issue.
I'll see if it is persistant when printing to PDF.
In the meantime I'd appreciate any help in resolving this issue.

Re: Inkscape 0.46-0.48 won't vector cut on ULS Laser

Posted: Thu Nov 07, 2013 8:45 am
by tylerdurden
mmunto wrote:I have exactly the same issue when I try to cut with the Laser Cutter Epilog Helix 60 W using Inkscape 0.46. No matter what settings I use that only rasters data, never
cuts and the computer attached only runs in Windows. I can't switch computers or OS because both laser and computer belong to TechShop (company that runs for profit) so I have to use the software they provide (CorelDraw).

I use Epilog Helix and Mini... both will not cut directly from Inkscape... files need to be saved as PDF and printed/cut from Adobe Reader.

Re: Inkscape 0.46-0.48 won't vector cut on ULS Laser

Posted: Thu Nov 07, 2013 8:47 am
by ragstian

For this type of problem I would use the "binary search" method, eliminating one piece of the "system" at a time.

A little more info about your laser system would be nice. What model LC? What OS? Which Inkscape version? Which extension version?
Does it print correctly from other applications?
If yes the problem lies "within" Inkscape - either in your Inkscape cutter extension or the SVG file itself.

This is easy to test by sending a file to the LC (laser cutter) with "hand-made" commands.

Is the communication between the LC and PC serial?
If yes - it would be easy to install a "serial sniffer" program which enables you to look at the commands being sent to the cutter.
You will then be able to see if the correct line thickness for cuts are sent to your LC.
Another way to analyze the output is to print to a file. Add a printer, - File - Generic - Text Only.
You will the be asked for a file name when printing.
After printing open this file with your favorite text editor and look at the commands.
All cutting is done after the "PD" commands (Pen Down).
Still another way to test the output is to install a plotter simulator- there are several free versions on the net.

From one of the ULS LC manuals:
    If laser cutting is desired, set the line thickness of the lines that are drawn
    in the graphics software to 0.001 inches (0.025 mm) or the smallest possible line thickness available.

(From personal experience - in nine out of ten cases these problems can be attributed to "PEBKAC" - Problem Exists Between Keyboard And Chair!
Don't ask how I know :) )

Please provide some more info - if possible post a "probematic" SVG file plus printer output.


Re: Inkscape 0.46-0.48 won't vector cut on ULS Laser

Posted: Wed Dec 31, 2014 2:00 pm
by Selroth
I'm having the exact same issue. I just got a ULS Versalaser VL200, and my WinXP 32-bit laptop running Inkscape does not print "vector cuts" (just raster) with any stroke width including 0.001mm. All other functions appear normal. But, those vector cuts would sure save a lot of time for those vertical cuts... I have to use another application to get those done, but I'd really love to just use Inkscape.

Anyway, I remember reading in the manual that it doesn't accept postscript. So, I think that's out. The communication between the laser cutter and the PC is USB, but the problem can be identified before then. In the "Versalaser Control Panel", you can preview your image before starting the job, and vector cuts appear as red (default - you can specify what different colors are enabled and what each means, but I promise this is configured correctly along with all other settings). Red line - vector cut. Black line - raster etched line. So the problem is happening somewhere between Inkscape, and the Versalaser drivers. It's not the commands being sent to the hardware.

The laser cutter is at my shop, and I'm at home ATM, so I'll see what results I get with the Extensions>Export command. Thank you for the files in the zip! But, I wouldn't be surprised if I get the exact same new problems as crakkhead earlier.

Re: Inkscape 0.46-0.48 won't vector cut on ULS Laser

Posted: Fri Sep 29, 2017 5:05 am
by Slartybartfast
OK - So for everybody that's having scaling problems with their laser, here's a soluton... Edit the Python file that is the win32 vector print.

Full disclaimer - I don't know python, I'm a bad programmer, but I tried this and it works. I know this thread is old, but this IS THE SOLUTION. Or at least one of them, but lacking anything better, THIS IS IT. Multiply the Y axis by 2. Wham. See below.

For me it's located here:
C:\Program Files\Inkscape\share\extensions

It's possible, and even LIKELY that this change will stretch the output of any other device you print to, but for OUR crappy old laser cutter, it works gangbusters. Make sure you convert all your objects to paths.

Add the *2 to the line shown:
self.groupmat = [[[self.scale, 0.0, 0.0], [0.0, self.scale*2, 0.0]]] # Andy changed this to make it print right.

Here's the ENTIRE python script because I can't attach a .py file..nooooOOooo.

Code: Select all

#!/usr/bin/env python
This extension will generate vector graphics printout, specifically for Windows GDI32.

Copyright (C) 2012 Alvin Penner,

Broken and stretched along the Y axis by Andy Baker
so it only works with ULS laser cutters September 2017

This is a modified version of the file by Aaron Spike,
It will write only to the default printer.
The printing preferences dialog will be called.
In order to ensure a pure vector output, use a linewidth < 1 printer pixel

- see
- get at

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
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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
# standard library
from ctypes import *
# local library
import inkex
import simplestyle
import simpletransform
import cubicsuperpath

inkex.localize()                        # Initialize gettext
if not inkex.sys.platform.startswith('win'):
    exit(_("sorry, this will run only on Windows, exiting..."))

myspool = WinDLL("winspool.drv")
mygdi = WinDLL("gdi32.dll")
LOGBRUSH = c_long*3
DM_IN_PROMPT = 4                        # call printer property sheet
DM_OUT_BUFFER = 2                       # write to DEVMODE structure

class MyEffect(inkex.Effect):
    def __init__(self):
        self.visibleLayers = True       # print only visible layers

    def process_shape(self, node, mat):
        rgb = (0,0,0)                   # stroke color
        fillcolor = None                # fill color
        stroke = 1                      # pen width in printer pixels
        # Very NB : If the pen width is greater than 1 then the output will Not be a vector output !
        style = node.get('style')
        if style:
            style = simplestyle.parseStyle(style)
            if style.has_key('stroke'):
                if style['stroke'] and style['stroke'] != 'none' and style['stroke'][0:3] != 'url':
                    rgb = simplestyle.parseColor(style['stroke'])
            if style.has_key('stroke-width'):
                stroke = self.unittouu(style['stroke-width'])/self.unittouu('1px')
                stroke = int(stroke*self.scale)
            if style.has_key('fill'):
                if style['fill'] and style['fill'] != 'none' and style['fill'][0:3] != 'url':
                    fill = simplestyle.parseColor(style['fill'])
                    fillcolor = fill[0] + 256*fill[1] + 256*256*fill[2]
        color = rgb[0] + 256*rgb[1] + 256*256*rgb[2]
        if node.tag == inkex.addNS('path','svg'):
            d = node.get('d')
            if not d:
            p = cubicsuperpath.parsePath(d)
        elif node.tag == inkex.addNS('rect','svg'):
            x = float(node.get('x'))
            y = float(node.get('y'))
            width = float(node.get('width'))
            height = float(node.get('height'))
            p = [[[x, y],[x, y],[x, y]]]
            p.append([[x + width, y],[x + width, y],[x + width, y]])
            p.append([[x + width, y + height],[x + width, y + height],[x + width, y + height]])
            p.append([[x, y + height],[x, y + height],[x, y + height]])
            p.append([[x, y],[x, y],[x, y]])
            p = [p]
        trans = node.get('transform')
        if trans:
            mat = simpletransform.composeTransform(mat, simpletransform.parseTransform(trans))
        simpletransform.applyTransformToPath(mat, p)
        hPen = mygdi.CreatePen(0, stroke, color)
        mygdi.SelectObject(self.hDC, hPen)
        if fillcolor is not None:
            brush = LOGBRUSH(0, fillcolor, 0)
            hBrush = mygdi.CreateBrushIndirect(addressof(brush))
            mygdi.SelectObject(self.hDC, hBrush)

    def emit_path(self, p):
        for sub in p:
            mygdi.MoveToEx(self.hDC, int(sub[0][1][0]), int(sub[0][1][1]), None)
            POINTS = c_long*(6*(len(sub)-1))
            points = POINTS()
            for i in range(len(sub)-1):
                points[6*i]     = int(sub[i][2][0])
                points[6*i + 1] = int(sub[i][2][1])
                points[6*i + 2] = int(sub[i + 1][0][0])
                points[6*i + 3] = int(sub[i + 1][0][1])
                points[6*i + 4] = int(sub[i + 1][1][0])
                points[6*i + 5] = int(sub[i + 1][1][1])
            mygdi.PolyBezierTo(self.hDC, addressof(points), 3*(len(sub)-1))

    def process_clone(self, node):
        trans = node.get('transform')
        x = node.get('x')
        y = node.get('y')
        mat = [[1.0, 0.0, 0.0], [0.0, 1.0, 0.0]]
        if trans:
            mat = simpletransform.composeTransform(mat, simpletransform.parseTransform(trans))
        if x:
            mat = simpletransform.composeTransform(mat, [[1.0, 0.0, float(x)], [0.0, 1.0, 0.0]])
        if y:
            mat = simpletransform.composeTransform(mat, [[1.0, 0.0, 0.0], [0.0, 1.0, float(y)]])
        # push transform
        if trans or x or y:
            self.groupmat.append(simpletransform.composeTransform(self.groupmat[-1], mat))
        # get referenced node
        refid = node.get(inkex.addNS('href','xlink'))
        refnode = self.getElementById(refid[1:])
        if refnode is not None:
            if refnode.tag == inkex.addNS('g','svg'):
            elif refnode.tag == inkex.addNS('use', 'svg'):
                self.process_shape(refnode, self.groupmat[-1])
        # pop transform
        if trans or x or y:

    def process_group(self, group):
        if group.get(inkex.addNS('groupmode', 'inkscape')) == 'layer':
            style = group.get('style')
            if style:
                style = simplestyle.parseStyle(style)
                if style.has_key('display'):
                    if style['display'] == 'none' and self.visibleLayers:
        trans = group.get('transform')
        if trans:
            self.groupmat.append(simpletransform.composeTransform(self.groupmat[-1], simpletransform.parseTransform(trans)))
        for node in group:
            if node.tag == inkex.addNS('g','svg'):
            elif node.tag == inkex.addNS('use', 'svg'):
                self.process_shape(node, self.groupmat[-1])
        if trans:

    def effect(self):
        pcchBuffer = c_long()
        myspool.GetDefaultPrinterA(None, byref(pcchBuffer))     # get length of printer name
        pname = create_string_buffer(pcchBuffer.value)
        myspool.GetDefaultPrinterA(pname, byref(pcchBuffer))    # get printer name
        hPrinter = c_long()
        if myspool.OpenPrinterA(pname.value, byref(hPrinter), None) == 0:
            exit(_("Failed to open default printer"))

        # get printer properties dialog

        pcchBuffer = myspool.DocumentPropertiesA(0, hPrinter, pname, None, None, 0)
        pDevMode = create_string_buffer(pcchBuffer + 100) # allocate extra just in case
        pcchBuffer = myspool.DocumentPropertiesA(0, hPrinter, pname, byref(pDevMode), None, DM_IN_PROMPT + DM_OUT_BUFFER)
        if pcchBuffer != 1:             # user clicked Cancel

        # initiallize print document

        docname = self.document.getroot().xpath('@sodipodi:docname', namespaces=inkex.NSS)
        if not docname:
            docname = ['New document 1']
        lpszDocName = create_string_buffer('Inkscape ' + docname[0].split('\\')[-1])
        DOCINFO = c_long*5
        docInfo = DOCINFO(20, addressof(lpszDocName), 0, 0, 0)
        self.hDC = mygdi.CreateDCA(None, pname, None, byref(pDevMode))
        if mygdi.StartDocA(self.hDC, byref(docInfo)) < 0:
            exit()                      # user clicked Cancel

        self.scale = (ord(pDevMode[58]) + 256.0*ord(pDevMode[59]))/96    # use PrintQuality from DEVMODE
        self.scale /= self.unittouu('1px')
        self.groupmat = [[[self.scale, 0.0, 0.0], [0.0, self.scale*2, 0.0]]] # Andy changed this  and added the *2 to make it print right on a crappy laser.
        doc = self.document.getroot()

if __name__ == '__main__':
    e = MyEffect()

# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99

So there's that. Just replace the with the contents shown there, or add the *2 to the self.groupmat line.

Re: Inkscape 0.46-0.48 won't vector cut on ULS Laser

Posted: Sun Oct 01, 2017 10:57 pm
by brynn
Since this topic that you posted in is about versions 0.46 to 0.48, should we assume this code is meant to fix extensions in that version?

Did the fix provided earlier in this topic not work for you? Were you able to test it as requested by the developer who offered the fix? As far as I understand "developer-speak" fix committed means that there's a branch with the fix in it, but not necessarily that that fix was ever released. There may be more info in the referenced bug report, with I didn't look up (because this topic is so old).

Or is this code meant to "fix" the current Inkscape version 0.92.2? If so, do you know if there's a bug report for it? If so, you should post this there, so that other developers can review it.

If you're using 0.92.x, you might need to learn about the change in unit handling. Either because it might fix the problem you're having, or just because it might be helpful to understand. ... rogram-xyz

Re: Inkscape 0.46-0.48 won't vector cut on ULS Laser

Posted: Sat Oct 07, 2017 3:05 am
by Slartybartfast
Hit here,

So in reading that FAQ, I can see that the units problem it references isn't what was going on here, because it's happening only in one axis, and it's happening at exactly 50% and not in a units mismatch, which I'm well trained to see.

I AM in fact using 0.92, and this "problem" still happens, and obviously existed in 0.46 and 0.48, but I'm not actually sure if this IS a problem for anything aside from these ULS laser cutters. I don't have a plotter to test it on for example. All I can say is that for THIS particular problem, the solution I provided fixes it on this one class of hardware. I don't know if this problem exists in the firmware of the ULS cutters ONLY, or if it's across the board. I can say with great certainty that our laser cutter is the most temperamental and annoying thing in the whole shop aside from the fax machine, so I wouldn't rule out a problem on its end. That said, I expect that the modification I made WILL break other vector prints on other hardware. BUT I can't test it.

BIG DISCLAIMER - I'm not a programmer! I know enough about Python to be dangerous (except in this case) and when I do make code changes, I usually email them to somebody in the office that knows how to use GIT and they handle the rest. Everybody hates me for it, but it's what makes sense. I'm kind of hoping a real programmer will take the changes I made and fix my jerk-off implementation and do it right.


Re: Inkscape 0.46-0.48 won't vector cut on ULS Laser

Posted: Sun Oct 08, 2017 9:22 am
by brynn
Hi Andy,
No, the units issue is particular to 0.92.x So if this is the same problem which existed in 0.46 to 0.48, it would not be relevant. I wasn't sure from your previous post (in large part probably because I scarcely understand development and coding language).

Since your problem is the same as the op, I wonder if you saw this reply:
alvinpenner wrote:fix committed to bzr rev 11575, any testing would be welcome.

Alvin Penner

I sounds as if a fix was written, and committed to some branch. Perhaps it never made to into a stable version. I don't know, I didn't read the report (and even if I did, I probably can't understand it). Perhaps it was because it was never tested? I don't know.

I didn't even read this entire thread. Just from skimming through it, it sounds like a few different people have contributed bits and pieces. It would probably be helpful if.... Well I mean, it sounds like this whole issue could use someone to sort through it all, organize it if necessary, and try to bring everything up to date. If you have the time and motivation.

In any case, an Inkscape developer isn't likely to see your code here, if that's what you meant by "real programmer". For some reason, Inkscape developers rarely visit forums. That's why I suggested posting it to the relevant bug report, so that developers can review it.

I suppose it's possible someone with the right skills will see it here. But the best chance of someone in the Inkscape community using it, is probably if they can find it in the bug tracker. This is the bug report that was referenced early in this post
Further info is available at comment 12, 13

I assume it would be the one where you should post this. But you would be a better judge of that than me. If you can't find a relevant report, please feel free to start a new one.