Testing TechDraw: SVG export failing ?

Discussions about the development of the TechDraw workbench
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
HoWil
Veteran
Posts: 1279
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Testing TechDraw: SVG export failing ?

Post by HoWil »

wandererfan wrote:Discussion requested
Dear wandererfan,

I use Freecad/techdraw to export 2d-sections of my parts for laser-cutting.
The problem I face is that the exported lines in the .svg are slightly scaled by a factor of 1.016 resulting in slightly to large cutted parts.
The linewidth is here not the problem. When exporting the same part/view from Drawing-wb everything works fine :o !

Please try it on your system by drawing a rel. large part. Create a drawing of it and export it to .svg. Use the measure tool in inkscape with "snap curps nodes" and measure the length of the part.
I also attached a simple model of a 200mm long bar which is in the exported .svg 203.2mm. Please see the attached screenshot showing the measurement in Inkscape.
Screenshot from 2017-03-21 11-09-57.png
Screenshot from 2017-03-21 11-09-57.png (239.3 KiB) Viewed 4020 times
mod_with_drawing.fcstd
(17.78 KiB) Downloaded 125 times
Is this already known??

Thanks in advance,
HoWil

BTW: in the screenshot is also another problem visible.... the text of the dimensions is always shifted when opening it in inkscape (or firefox).
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Testing TechDraw

Post by NormandC »

Hello HoWil,

You really should remember to post your FreeCAD info.
HoWil wrote:The problem I face is that the exported lines in the .svg are slightly scaled by a factor of 1.016 resulting in slightly to large cutted parts.
The problem is not with FreeCAD, nor with the TechDraw workbench. It's with Inkscape.

Did you know that QCad can open SVG files? I have an AppImage of QCad 3.15 here. After opening an SVG exported from your FreeCAD file, I added a horizontal dimension. It is exactly 200mm.

BLUE = edit
Attachments
QCad_HoWil_TechDraw_svg_export_01.png
QCad_HoWil_TechDraw_svg_export_01.png (105.33 KiB) Viewed 3987 times
Last edited by NormandC on Tue Mar 21, 2017 11:41 pm, edited 1 time in total.
User avatar
wandererfan
Veteran
Posts: 6309
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Testing TechDraw

Post by wandererfan »

@NormandC has answered most of your questions. Merci, Normand.
HoWil wrote:Please try it on your system by drawing a rel. large part. Create a drawing of it and export it to .svg. Use the measure tool in inkscape with "snap curps nodes" and measure the length of the part.
I cannot duplicate this. I get 200mm in Inkscape:
HoWil_Inkscape.png
HoWil_Inkscape.png (112.45 KiB) Viewed 3980 times
the text of the dimensions is always shifted when opening it in inkscape (or firefox).
Yes, I'm afraid most text (not just dimensions) is shifted when exported as SVG. I haven't figured that one out yet.

wf
User avatar
saso
Veteran
Posts: 1924
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Testing TechDraw

Post by saso »

This could be the case because in Inkscape version 0.92 the default resolution was changed from 90dpi to 96dpi, to match the CSS standard.

http://wiki.inkscape.org/wiki/index.php ... nt_changes
https://www.peppercarrot.com/en/article ... h-inkscape
https://www.peppercarrot.com/en/article ... h-inkscape

PS: I have noticed opening our svg icons in the new Inkscape 0.92 shows the dialog about this change, I wounder what the best and safest way is to upgrade our icons?! :|
HoWil
Veteran
Posts: 1279
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: Testing TechDraw

Post by HoWil »

NormandC wrote:Hello HoWil,

You really should remember to post your FreeCAD info.
Sorry about that....
OS: Ubuntu 16.04.2 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.10530 (Git)
Build type: None
Branch: master
Hash: d920cf419d9ed8274d10597364d92f224ded7b4f
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0
HoWil
Veteran
Posts: 1279
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: Testing TechDraw

Post by HoWil »

NormandC wrote: The problem is not with FreeCAD, nor with the TechDraw workbench. It's with Inkscape.

Did you know that QCad can open SVG files? I have an AppImage of QCad 3.15 here. After opening an SVG exported from your FreeCAD file, I added a horizontal dimension. It is exactly 200mm.

BLUE = edit
Why is than the drawing exported with drawing-wb exactly the size as shown in FC (e.g. 200mm) while with techdraw-wb I get 203.2mm.
Inkscape is the defacto standard app for svg, isnt it? (Alternatively I use librecad (equivalent to qcad) but have to see if it can import svg.)
I did this export several times before with drawing-wb and had no problems with fabrication but how I have to large parts on the table... so there is a prob :D .
I attached the two .svgs I just exported with fc techdraw and drawing-wb.

Thanks in advance,
HoWil
EDIT: Added output_techdraw.svg as .zip because otherwise I get the following error "Error The upload was rejected because the uploaded file was identified as a possible attack vector."... the other .svg worked without probs =)
Attachments
output_techdraw.svg.zip
203.2mm in inkscape
(41.89 KiB) Downloaded 101 times
output_drawing.svg
200mm in inkscape
(75.36 KiB) Downloaded 317 times
Last edited by HoWil on Wed Mar 22, 2017 10:14 am, edited 2 times in total.
HoWil
Veteran
Posts: 1279
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: Testing TechDraw

Post by HoWil »

saso wrote:This could be the case because in Inkscape version 0.92 the default resolution was changed from 90dpi to 96dpi, to match the CSS standard.
But why is then there a difference between drawing wb and techdraw?
Thx
HoWil
Veteran
Posts: 1279
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: Testing TechDraw

Post by HoWil »

Here another comparison with Inkscape 0.92 opening and measuring both drawings with the measurement tool.
Screenshot from 2017-03-22 10-58-52.png
Screenshot from 2017-03-22 10-58-52.png (170.38 KiB) Viewed 4039 times
Same system, same FC, same Inkscape.
BR,
HoWil
HoWil
Veteran
Posts: 1279
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: Testing TechDraw

Post by HoWil »

NormandC wrote:Hello HoWil,
Did you know that QCad can open SVG files? I have an AppImage of QCad 3.15 here.
Dear NormandC,
Why not using FC ;) .
BR,
HoWil
Comparison of both .svgs opend and measured in FC0.17.
Comparison of both .svgs opend and measured in FC0.17.
Screenshot from 2017-03-22 11-07-19.png (206.58 KiB) Viewed 4037 times
User avatar
wandererfan
Veteran
Posts: 6309
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Testing TechDraw

Post by wandererfan »

HoWil wrote:I attached the two .svgs I just exported with fc techdraw and drawing-wb.
my TechDraw output:
<svg width="297mm" height="210mm"
viewBox="0 0 2970 2100"

your TechDraw output:
<svg width="301.752mm" height="213.36mm"
viewBox="0 0 297 210"

301.752 / 297 = 1.016
1.016 * 200 = 203.2

It appears your version of FC does not include this fix:
git commit 94a647a94c Fix Svg export page & text size in HiRez (merged Jan 29, 2017) which addressed this issue.

Your version seems to predate this version http://www.forum.freecadweb.org/viewtop ... =9&t=20385 since the viewBox numbers are only 3 digits instead of 4.

This confuses me a bit since your git version would seem to be new enough to include these changes.
Post Reply