Login  Register

Re: Print Scale Factor

Posted by Rallaz on Jun 21, 2012; 3:56pm
URL: https://forum.librecad.org/Print-Scale-Factor-tp5706781p5706793.html

The var $PSVPSCALE was introduced in DXF 2000 and stores
"View scale factor for new viewports" that is, when you create a
new "viewport" entity in paper space this entity are created using
the relation into model/paper stored in this var.
Valid values:
0 = Scaled to fit
>0 = Scale factor (a positive real value).

In DXF the print configuration are stored in OBJECTS section as
PLOTSETTINGS.
The PLOTSETTINGS object contains print scale, paper size, print
area and more.

LibreCAD implementation:
Read/write object section are NOT implemented in dxf library,
therefore can not be saved PLOTSETTINGS object, but the var
$PSVPSCALE are read and saved.
seem that QCAD uses $PSVPSCALE for save the scale factor
and LC also, but in first call to print preview are called
RS_ActionPrintPreview::fit().

Dongxu, I think you know better than me the code relating to
printing, but I think with a few simple changes could work:

One possibility is something like:
File qg_printpreviewoptions.cpp
line #123 void QG_PrintPreviewOptions::setAction(...)

                updateDisabled=true;
                setScaleFixed(true);
            }else{
-                fit();
+                double currScale = graphic->getGraphicVar("$PSVPSCALE", 0);
+                if(currScale  > 0.0)
+                    scale (currScale);
+                else
+                    fit();
                setScaleFixed(false);
            }
        }else{

Another option are check "$PSVPSCALE" in
RS_ActionPrintPreview::showOptions() and initialize one double var,
then in QG_PrintPreviewOptions::setAction() call scale() with this value
instead of call fit()