SVG Import issues

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
User avatar
easyw-fc
Veteran
Posts: 3633
Joined: Thu Jul 09, 2015 9:34 am

Re: SVG Import issues

Post by easyw-fc »

Syres wrote: Wed Jul 17, 2019 9:34 am I'll look into it but at least my modification doesn't make things worse which was my first concern.
Humm it seems it is something related to stroke width...
Your previous version is fine if the stroke is set to almost 0mm and the box size is 100mm, the new one is oversizing the box
-
box-line-stroke-0.svg
(2.09 KiB) Downloaded 35 times
leoheck
Veteran
Posts: 1225
Joined: Tue Mar 13, 2018 5:56 pm
Location: Coffee shop

Re: SVG Import issues

Post by leoheck »

I am conducting my tests here, using SVG files created by me with Inkscape 0.92.4 (5da689c313, 2019-01-14)

I am using the default SVG importer initially.

# CASE 1

First, I am importing three 10 mm x 10 mm squares each of them with different stroke configs.
The square dimensions were set after settings the strokes. So, all of them have the same dimensions considering the stroke.
1. No stroke
2. 0.1 mm stroke
3. 1 mm stroke

In this case, I saw that the Freecad is importing the right dimensions for the square reducing the stroke thickness
1. The square #1 was Imported as 10x10 mm square (top-left corner placed at the origin 0x0)
2. The square #2 was Imported as 9.9x9.9 mm square (top-left corner placed at the origin 0.05x0.05)
3. The square #3 was Imported as 9x9 mm square (top-left corner placed at the origin 0.5x0.5)

It looks like it is respecting Inkscape dimensions, considering the shape. It also moves the object to the half of the stroke thickness down and to the right of the origin.

The objects were converted to a sketch, (using Draft > "Conver bidirectionally..." tool) then measurements were performed using the constraints.
User avatar
Chris_G
Veteran
Posts: 2601
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: SVG Import issues

Post by Chris_G »

Hi,
You probably know this, but just in case, are you all using the same bounding box model in Inkscape ?
- Edit -> Preferences -> Tools -> Bounding box model to use -> Geometric (ignores stroke width) or Visual.
Syres
Veteran
Posts: 2902
Joined: Thu Aug 09, 2018 11:14 am

Re: SVG Import issues

Post by Syres »

As I have to go back to income generation today I wanted to leave this at a straight edge.

I've submitted a further commit with all the Github comments/suggestions in the PR and an additional two bugfixes that I found myself but based on @ChrisG's feedback I've left the rectangle code as is and explains why there's no stroke width allowance in that part of the code.

If the PR gets merged, I'll gather together a set of words for the Wiki to bring it in line but may need assistance with the submission.
leoheck
Veteran
Posts: 1225
Joined: Tue Mar 13, 2018 5:56 pm
Location: Coffee shop

Re: SVG Import issues

Post by leoheck »

Thank you Chris_G, I didn't know that. I was using the standard config which is "Visual bounding box".
leoheck
Veteran
Posts: 1225
Joined: Tue Mar 13, 2018 5:56 pm
Location: Coffee shop

Re: SVG Import issues

Post by leoheck »

Ok, I was able to import my flower-like (circular pattern) with the right dimensions by disabling the stroke (I am also using the Geometry view so I can control better what I want). Still using the default importer that comes with Freecad.

I would suggest improving at least the SVG import popup. I also would like to have the origin centered in most of my imports if possible.

Code: Select all

OS: Ubuntu 19.04
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.2.
Build type: Release
Python version: 3.7.3
Qt version: 5.12.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/United States (en_US)
Post Reply