Problem with the scale of views made with the draftview command

Discussions about the development of the TechDraw workbench
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Renato Rebelo
Posts: 255
Joined: Mon May 19, 2014 1:14 pm
Location: Vouzela - Portugal

Problem with the scale of views made with the draftview command

Post by Renato Rebelo »

Hello,
There is a problem with the scale of views made with the draftview command. The views are 10 times bigger than they should have been.
From what I was able to test only happens with the views made with the draftview and Archview commands, the views made with the DrawViewPart command are in the right scale.
greetings,
Renato Rebelo

OS: Ubuntu 16.04.2 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.10802 (Git)
Build type: None
Branch: master
Hash: 10ce910c03347a90712327a7cc7be2bcdee13afc
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0
my native language is not English, please excuse me any incorrectness, I apologize for any inconvenience caused, thank you
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Problem with the scale of views made with the draftview command

Post by microelly2 »

There is a default scale value HintScale=10.0 in the page object
set this back to 1 should work
Attachments
bp_460.png
bp_460.png (11.39 KiB) Viewed 3066 times
User avatar
yorik
Founder
Posts: 13660
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Problem with the scale of views made with the draftview command

Post by yorik »

Indeed, I see the problem too, that's strange... The transform (position, rotation, scaling) is done by techdraw itself, not sure what has changed there... rotation and positionning still work correctly. But I couldn't really find where that 10x scaling happens.

Any idea @wandererfan? Could it be something to do with DPI stuff? There is this note in QGIViewSymbol.cpp

Code: Select all

//note: svg's are overscaled by (72 pixels(pts actually) /in)*(1 in/25.4 mm) = 2.834645669   (could be 96/25.4(CSS)? 110/25.4?)
//due to 1 sceneUnit (1mm) = 1 pixel for some QtSvg functions
But it doesn't seem to be used anywhere...
User avatar
wandererfan
Veteran
Posts: 6317
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Problem with the scale of views made with the draftview command

Post by wandererfan »

January update: https://www.forum.freecadweb.org/viewto ... =9&t=20385
High Resolution - the resolution of drawings has been increased, in some cases as much as 10x. This will impact users of DrawViewImage, providing much higher quality results.

It will also affect users of DrawViewDraft and DrawViewArch. The higher resolution will mean that scales and perhaps positions will need to be modified. Existing drawings may need views repositioned.
You can turn HiRez off, but that will bring it's own problems - poor quality imported images and wrong size SVG exports among others.
User avatar
yorik
Founder
Posts: 13660
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Problem with the scale of views made with the draftview command

Post by yorik »

Too much info on this forum, you always loose something :)

We could counter the problem by embedding the svg code in a transform node in Draft and Arch views, and therefore add an extra scaling, that's easy.
Is there a way to know how much extra scaling I should add?
User avatar
wandererfan
Veteran
Posts: 6317
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Problem with the scale of views made with the draftview command

Post by wandererfan »

yorik wrote:Is there a way to know how much extra scaling I should add?
#include <Mod/TechDraw/Gui/Rez.h>
...
double factor = Rez::getRezFactor();
double guisize = Rez::guiX(someAppNumber); //mm to QGraphicsScene units
double appsize = Rez::appX(someGuiNumber); //QGraphicsScene units to mm

Overloads for Base::Vector3d, Base::Vector2d, QPointF, QSize, QRectF.

No Python version yet.
User avatar
yorik
Founder
Posts: 13660
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Problem with the scale of views made with the draftview command

Post by yorik »

wandererfan wrote:#include <Mod/TechDraw/Gui/Rez.h>
...
double factor = Rez::getRezFactor();
double guisize = Rez::guiX(someAppNumber); //mm to QGraphicsScene units
double appsize = Rez::appX(someGuiNumber); //QGraphicsScene units to mm

Overloads for Base::Vector3d, Base::Vector2d, QPointF, QSize, QRectF.

No Python version yet.
Okay that should do it, I can use that inside the cpp code of ArchView and DraftView.
Thanks!

*EDIT*

double factor = Rez::getRezFactor(); doesn't seem to work when called from an App object (besides it is probably wrong to use Gui stuff in App)... Any idea of a workaround? Or maybe it is in the Gui side that the extra scaling should happen? In QGIViewSymbol::drawSvg() maybe?

**EDIT 2** Done in git commit 17b597fb6
User avatar
wandererfan
Veteran
Posts: 6317
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Problem with the scale of views made with the draftview command

Post by wandererfan »

yorik wrote:
Or maybe it is in the Gui side that the extra scaling should happen? In QGIViewSymbol::drawSvg() maybe?
**EDIT 2** Done in git commit 17b597fb6[/quote]
Great thanks!. The scaling is only done on the Gui side since it is basically a hack to get some QGraphicsScene functions to behave as if they understand floating point numbers.
Renato Rebelo
Posts: 255
Joined: Mon May 19, 2014 1:14 pm
Location: Vouzela - Portugal

Re: Problem with the scale of views made with the draftview command

Post by Renato Rebelo »

It's OK now
Thank you both,
Renato Rebelo :D
my native language is not English, please excuse me any incorrectness, I apologize for any inconvenience caused, thank you
HoWil
Veteran
Posts: 1279
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: Problem with the scale of views made with the draftview command

Post by HoWil »

Is it possible to switch the factor 10 scale off when exporting. This would resolve this prob:
https://forum.freecadweb.org/viewtopic. ... 7&start=30

Quickly tested it on the following system and still see a factor x10 in the view(-box) in Inkscape:
OS: Ubuntu 16.04.2 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.10909 (Git)
Build type: None
Branch: master
Hash: eb5c56b50297a03b275846c7bb064ad4aae094da
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0

BR,
HoWil
Screenshot from 2017-04-25 15-31-18.png
Screenshot from 2017-04-25 15-31-18.png (97.9 KiB) Viewed 2778 times
Post Reply