View Issue Details

IDProjectCategoryView StatusLast Update
0003420FreeCADBugpublic2021-02-06 06:49
Reporterherrdeh Assigned Toyorik  
PrioritynormalSeveritymajorReproducibilityalways
Status assignedResolutionopen 
PlatformallOSallOS Versionall
Product Version0.17 
Target Version0.20 
Summary0003420: SVG imports from inkscape lead to wrong dimensions
DescriptionWith the change from 0.91 to 0.92 inkscape devs changed the conversion factor of userunit (uu) and mm. Pre-0.92 it was 1uu=1 inch/90 and starting from 0.92 it is 1 uu=1inch/96. This was necessary to meet the actual recommendations/rules of svg-standard and css. See this article in inkscapewiki for further reading.

When a user creates a file in inkscape with absolute dimensions (mm) and saves it, then imports it into FC, bodies in Freecad come out with too large dimensions. For example - a 100mm square will be 106,66mm in FC now (100 x 96/90).

In this discussion in the German forum folks who can read German can follow the process of isotating the bug.

New forum thread opened in https://forum.freecadweb.org/viewtopic.php?f=8&t=37102
Steps To ReproduceImport a SVG file from inkscape >=0.92 - check measures.
Tagsimport, Inkscape, SVG
FreeCAD Information

Relationships

related to 0003304 new Integrate Inkscape in to FreeCAD 
has duplicate 0004200 closed Import from SVG gets wrong scale 

Activities

yorik

2018-04-03 15:38

administrator   ~0011114

Would it be possible to provide two very simle test files that would allow to check the results?

herrdeh

2018-04-04 08:12

reporter  

herrdeh

2018-04-04 08:14

reporter   ~0011120

Here are inkscape test files. Unluckily, none of my FC versions are capable of SVG import at the moment, so I cannot provide FC test files. But importing both of these examples should lead to different squares, allthough both of them are 100x200mm in inkscape.

yorik

2018-04-04 14:07

administrator   ~0011121

Thanks! I'll have a look at this after the release is out.

Kunda1

2019-06-17 14:59

administrator   ~0013238

New forum discussion thread opened in https://forum.freecadweb.org/viewtopic.php?f=8&t=37102

teo8976

2019-11-23 13:40

reporter   ~0013837

This has nothing to do specifically with Inkscape, and it has nothing to do specifically with mm.

Look at the attached SVG file. I wrote this SVG file by hand, it was not exported from Inkscape:

<svg width="595.28pt" height="420.94pt"  viewBox="0 0 210 148" xmlns="http://www.w3.org/2000/svg">


This defines a physical size in pt for the document (which is A4) and a corresponding viewbox such that 1 user unit should be 2.83465 pt which is 1 mm.

Hence the physical size of 1 unit in the document should be that.
That is defined by the document.

I have imported this and exported to dxf and the resulting width of the 190mm rectangles is about 185mm.

Then for some reason, if instead of exporting to dxf I print it to pdf (not export to pdf, print and select "print to pdf"), for some reason they're even much smaller.
But I don't know, maybe the "print" feature has no notion of a real physical size and just print everything to fit whatever paper size you choose.
1_08mm_plakene_DINA4.svg (1,455 bytes)   
1_08mm_plakene_DINA4.svg (1,455 bytes)   

openBrain

2019-11-24 13:30

developer   ~0013839

@teo8976 : actually it has to do with Inkscape because for long time, FreeCAD relies on Inkscape SVG format. Inkscape doesn't export a viewbox so user unit can't be arithmetically determined. Issue was that Inkscape was using a strange 90 dpi so FC converts with this setting. Inkscape has recently moved to SVG standard 96 dpi and it makes emerge some problems. Things has been greatly improved and I'm now able to correctly import your file with latest 0.19 (despite I found a small bug that I'll report). Time for you to leave your 0.15 release and upgrade. ;)

teo8976

2019-11-24 13:54

reporter   ~0013840

> Inkscape doesn't export a viewbox so user unit can't be arithmetically determined

Yeah but my file (which was not created by Inkscape) does have a viewbox AND document width and height on the root node, so the size of a user unit should be calculated from those without any fixed dpi involved. I haven't tried changing the width, height and viewbox though, to see whether the results differ (they should).

> Time for you to leave your 0.15 release and upgrade

I know, that's the version I got with apt-get. Time for [whoever maintains that] to release a more recent one for Ubuntu.

openBrain

2019-11-24 14:20

developer   ~0013841

@teo8976 : the file you posted in this ticket raised the evidence that 'pt' unit has been forever not well defined in FC. ;) I submitted this PR to fix it. However as I explained above, this only solves part of your problems as I explained above.
Everything should be OK with 0.19 version once the PR is integrated. Thanks for your perseverance.

yorik

2022-03-03 13:55

administrator   ~0016616

This ticket has been migrated to GitHub as issue 5781.

Issue History

Date Modified Username Field Change
2018-04-03 13:03 herrdeh New Issue
2018-04-03 13:03 herrdeh Tag Attached: import
2018-04-03 13:03 herrdeh Tag Attached: Inkscape
2018-04-03 13:03 herrdeh Tag Attached: SVG
2018-04-03 15:38 yorik Note Added: 0011114
2018-04-03 15:39 yorik Assigned To => yorik
2018-04-03 15:39 yorik Status new => assigned
2018-04-03 15:39 yorik Status assigned => feedback
2018-04-04 08:12 herrdeh File Added: Viereck-100x200-Rand0,1-inkscape092.svg
2018-04-04 08:12 herrdeh File Added: Viereck-100x200-Rand0,1-inkscape048.svg
2018-04-04 08:14 herrdeh Note Added: 0011120
2018-04-04 08:14 herrdeh Status feedback => assigned
2018-04-04 14:07 yorik Note Added: 0011121
2018-08-23 17:37 Kunda1 Target Version => 0.18
2018-12-05 13:10 yorik Target Version 0.18 => 0.19
2019-06-17 14:59 Kunda1 Description Updated
2019-06-17 14:59 Kunda1 Note Added: 0013238
2019-06-22 15:32 Kunda1 Relationship added related to 0003304
2019-11-22 16:39 openBrain Relationship added has duplicate 0004200
2019-11-23 13:40 teo8976 File Added: 1_08mm_plakene_DINA4.svg
2019-11-23 13:40 teo8976 Note Added: 0013837
2019-11-24 13:30 openBrain Note Added: 0013839
2019-11-24 13:54 teo8976 Note Added: 0013840
2019-11-24 14:20 openBrain Note Added: 0013841
2021-02-06 06:49 abdullah Target Version => 0.20