gotcha

Author Topic: SVG Dimensions not matching Inkscape GUI  (Read 1755 times)

April 02, 2017, 11:57:55 AM
Read 1755 times

bnnorman

  • Sr. Newbie

  • Offline
  • **

  • 5
I'm trying to parse an SVG created in Inkscape, using python, to convert to another format - basically using Inkscape to design a KiCad module which is also a textual file format. In Inkscape I have, for example, some rectangular pads for component soldering. The pads have a width and height of 2mm but when I view the SVG the width is given as width='0.071316272' and height='0.071316227'- no units. This is also odd since the GUI shows this as a 2mm square - the numbers are close enough to show it is square but I would have expected identical values.

I have set the document default to 'mm' so was expecting to see '2.0'. There is no transform on the shape and I am using Inkscape 0.92.1 r15371.

Is this a bug or is there an explanation which eludes me right now.

Many thanks if anyone can shed some light on this as it's a bit of a stumbling block for my coding.

I have attached the SVG file.

April 03, 2017, 05:08:41 AM
Reply #1

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
The issue is that you are using the 'visual bounding box' for displaying measurements in Inkscape.

All the boxes in your drawing have a very wide stroke, which goes beyond the area that is actually the rectangle. Remove the stroke to see how large the rectangles are really. Those boundaries, after removing the stroke, are the boundaries that any plotting program will use, and also define the rectangle size in the SVG code.

To use a geometrical bounding box for displaying the size of objects, go to the settings: Edit -> Preferences -> Tools: use geometric bounding box

Attached picture:
left: without stroke, right: with stroke

April 03, 2017, 09:02:19 AM
Reply #2

bnnorman

  • Sr. Newbie

  • Offline
  • **

  • 5
Fantastic - works like a charm. Thank you so very much for the very fast response.