Timmmm / robocut

Control vinyl cutters, including Craft Robo, Silhouette, Cameo and Portrait
http://robocut.org/
GNU General Public License v3.0
81 stars 28 forks source link

Reg marks files and scaling in Inkscape post v0.91 #9

Open bitterjug opened 10 months ago

bitterjug commented 10 months ago

Hi again. I've been cutting all weekend but I can't get reg marks to work properly. when I open the reg marks files in examples, Inkscape tells me they were created before v0.91 and I have to make a choice about how to convert them from 90dpi to 96 dpi. I've tried all options. I also tried making my own reg marks in a new Inkscape doc at exactly 180x240mm which is what Robocut is looking for by default. The cutter (Graphtec Craft Robo CC 330-20) locates the reg marks okay but then cuts out a shape that is to big by 1.066. That's the same ratio as 96:96. I don't understand how this can happen after the plotter just located all 3 reg marks. Does Robocut have a built-in assumption about 90dpi that's making it send too big paths to the cutter, or something?

Timmmm commented 10 months ago

Unfortunately I've never actually used the registration marks feature. Markus Schulz @.***) wrote that bit.

I did have a quick look though. It does seem like 90 dpi is hard-coded in Qt in some way, based on this comment and the linked code:

// See // https://code.woboq.org/qt5/qtsvg/src/svg/qsvghandler.cpp.html#_ZL15convertToPixelsdbN11QSvgHandler10LengthTypeE // The default size is derived from the width="" height="" svg attribute tags // assuming 90 DPI. QSizeF mediaSize(render.widthMm, render.heightMm);

It's also hard-coded in my code in PathPaintDevice.h

double pixelsPerMm = 90.0 / 25.4

You could try changing that to 96.0... but I suspect it has to be 90.0 to match what Qt defaults to. This stuff is kind of complicated and I can't remember the exact details. Are you using master or develop?

On Sat, 13 Jan 2024 at 17:55, Mark Skipper @.***> wrote:

Hi again. I've been cutting all weekend but I can't get reg marks to work properly. when I open the reg marks files in examples, Inkscape tells me they were created before v0.91 and I have to make a choice about how to convert them from 90dpi to 96 dpi. I've tried all options. I also tried making my own reg marks in a new Inkscape doc at exactly 180x240mm which is what Robocut is looking for by default. The cutter (Graphtec Craft Robo CC 330-20) locates the reg marks okay but then cuts out a shape that is to big by 1.066. That's the same ratio as 96:96. I don't understand how this can happen after the plotter just located all 3 reg marks. Does Robocut have a built-in assumption about 90dpi that's making it send too big paths to the cutter, or something?

— Reply to this email directly, view it on GitHub https://github.com/Timmmm/robocut/issues/9, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAC4ACTGFJAIN3MKWYMRULLYOLDCBAVCNFSM6AAAAABBZPBOZOVHI2DSMVQWIX3LMV43ASLTON2WKOZSGA4DANBRGQ4DGMA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Timmmm commented 10 months ago

I had more of a look into it and actually I think the code is correct, more or less. Qt is actually wrong in its SVG renderer - it uses 90 DPI instead of 96 DPI which SVG/CSS mandates. But it should only matter if you have objects in your SVG that use absolute units, e.g. <rect width="10cm">. Can you send the SVG you are cutting?

bitterjug commented 10 months ago

Thanks Tim and apologies for not replying quicker. Ive tried with a number of files now, each starting with from robocut/examples/Registration Marks - A4 H260.svg and accepting each of Inkscape's offers to resize the image by scaling (or not) and then savinvg as plain svg from innkscape. Most recent of these is attached. It contains a circle which my printer printed, along with the registration marks which the Robocut was able to find. And then the Robocut cut out a different circle that was, when I measured it, bigger by 1.066.

A4 Registration Marks-mcs

I had a look at its text and the only absolute units I can see are at the top level

<svg
   width="210mm"
   height="297mm"
   id="svg2"
   version="1.1"
   style="display:inline"
 ...

I don't know why my printer and the robocutter are interpreting these differently.