Printing Fixed scale issue

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
21 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Printing Fixed scale issue

pclem
When un-checking the Fixed scale box in one drawing, it un-checks it for other drawings, even if the other drawings are not loaded.

This is happening in 2.2.0 and 2.2.1rc2
Reply | Threaded
Open this post in threaded view
|

Re: Printing Fixed scale issue

dxli
Currently, the property is global, meaning once set, it's remembered and is set for all usages thereafter, before being changed by the end user.

pclem wrote
When un-checking the Fixed scale box in one drawing, it un-checks it for other drawings, even if the other drawings are not loaded.

This is happening in 2.2.0 and 2.2.1rc2
Reply | Threaded
Open this post in threaded view
|

Re: Printing Fixed scale issue

pclem
I think this may explain why I sometimes have to fiddle with the print preview settings for a drawing that I previously printed successfully. Be good if the preview settings could be per drawing. Can you read the last applied settings from the drawing? Would that eliminate the need for the Fixed setting or is there more to it then that?
Reply | Threaded
Open this post in threaded view
|

Re: Printing Fixed scale issue

pclem
This drawing is a 9x6 rectangle on 8.5x11 paper which was printed to pdf 1:1.
When I re-open the drawing and press PrintPreview, the scale shows 1:1 but the view shows it as Fit to page.
To change it back to 1:1, I have to select 1" = 1", hit enter, and then press Center to page.

rectangle.dxf
Rectangle.pdf

Reply | Threaded
Open this post in threaded view
|

Re: Printing Fixed scale issue

pclem
Further troubleshooting using ezdxf reveals that the paper size in the file is A3 instead of Letter. How does LivreCAD determine the paper size of the drawing?


Reply | Threaded
Open this post in threaded view
|

Re: Printing Fixed scale issue

dxli
Could you try the latest master (2.2.2_alpha)and the 2.2.1_rc?

We read the paper size from dxf.

At printing, the drawing is scaled and centered to fit the paper size.
pclem wrote
Further troubleshooting using ezdxf reveals that the paper size in the file is A3 instead of Letter. How does LivreCAD determine the paper size of the drawing?

Reply | Threaded
Open this post in threaded view
|

Re: Printing Fixed scale issue

pclem
Tried it on 2.2.1rc2 and alpha 36, both are showing scale of 1:1 when Preview is pressed but "Fit to page" is clearly ON meaning the scale is adjusted to 1.17778:1. If I then press the Auto Zoom, the scale shown in the box goes from 1:1 to  1.17778:1. It appears that "Fit to page" is asserted when the Preview is opened, not "center to page".




Reply | Threaded
Open this post in threaded view
|

Re: Printing Fixed scale issue

pclem
I also I get a Warning if I press "Fit to page" after opening the rectangle.dxf.

"Warning:: Paper size less than 10mm. Paper is too small for fitting to page
Please set paper size by Menu: Edit->Current Drawing Preferences->Paper"

On both 2.2.1rc2 and alpha1-54

I noticed the scale is now showing correctly in 54, thank you for that.
Reply | Threaded
Open this post in threaded view
|

Re: Printing Fixed scale issue

pclem
Another related message that happens when printing, "Paper size and/or margins have been changed!"

This is such a small change, is it from a rounding error when converting between inch and mm? Another clue.  

Reply | Threaded
Open this post in threaded view
|

Re: Printing Fixed scale issue

dxli
No, the difference is too much to be from rounding off.
pclem wrote
Another related message that happens when printing, "Paper size and/or margins have been changed!"

This is such a small change, is it from a rounding error when converting between inch and mm? Another clue.  

Reply | Threaded
Open this post in threaded view
|

Re: Printing Fixed scale issue

pclem
Looks like the printerSize is being converted from mm to inch. Any way to round the values to two decimal places? That may fix the issue with "Paper size and/or margins have been changed!"

 
Reply | Threaded
Open this post in threaded view
|

Re: Printing Fixed scale issue

pclem
In reply to this post by dxli
This appears to fix the problem I was having.

Reply | Threaded
Open this post in threaded view
|

Re: Printing Fixed scale issue

dxli
Did you run in a debugger and confirm we are actually comparing with a different unit.

If so, we have to fix this in 2.2.1 also.

Also, we are going to refactor some printing control code into a separate function. The current main application file is getting fat and hard to maintain. Especially, if we want easy codebase to attack new developers.

pclem wrote
This appears to fix the problem I was having.

Reply | Threaded
Open this post in threaded view
|

Re: Printing Fixed scale issue

pclem
Yes, I could see the paperSize was in inches and the printerSize was in mm which was causing the compare to fail. But I am now seeing another problem with the margins, there will be a miss match depending on the units chosen in the Printer Properties. If you leave the Printer Properties units set to mm, all is good when using Letter paper, but if you change the units to Inches, the margin compare will fail. It seems the values it gets from the printer may not always be in the correct units.

The printer code is very complex so refactoring would be welcomed. I am not a professional developer so would not be able to offer much help with that but could lend a hand with testing and troubleshooting once in a while.



Reply | Threaded
Open this post in threaded view
|

Re: Printing Fixed scale issue

pclem
I am starting to wonder if this comparison function is really necessary. My goal was to avoid having to click that waring message everytime I printed. Perhaps it should be disabled and let the user manage the page size and margins in whatever units they want.
Reply | Threaded
Open this post in threaded view
|

Re: Printing Fixed scale issue

dxli
I added a fix to master:

https://github.com/LibreCAD/LibreCAD/commit/6a3bd66b2821c9299ca1cbf1fccf09cf9255ef5f

The warning is necessary in a scenario like:

1, User set drawing paper size to A4;
2, In print preview, user adjusted scale and margins;
3, In the print dialog, user selected a different paper size letter (A4 not available at the printer).

In this case, a warning is desirable to avoid blindly printing A4 customized layout on letter.

We are going to apply the fix to 2.2.1

pclem wrote
I am starting to wonder if this comparison function is really necessary. My goal was to avoid having to click that waring message everytime I printed. Perhaps it should be disabled and let the user manage the page size and margins in whatever units they want.
Reply | Threaded
Open this post in threaded view
|

Re: Printing Fixed scale issue

pclem
There is still an issue with the Margins.

Reply | Threaded
Open this post in threaded view
|

Re: Printing Fixed scale issue

dxli
Also modified to ignore differences within 2 pixels: most device driver should report to the closest pixel values. Using a tolerance of 2 pixels to avoid rounding errors in comparing floating points. We may switch to ULP of floating points in 2.2.2.

The code is ugly to ease backporting to 2.2.1, and in 2.2.2 we should do some refactoring to avoid those long functions in a single huge file.

The commit:

https://github.com/LibreCAD/LibreCAD/commit/459a626a6d8a47d28b1558b7953bd419a01d3643

pclem wrote
There is still an issue with the Margins.

Reply | Threaded
Open this post in threaded view
|

Re: Printing Fixed scale issue

pclem
So there is still an issue with the margins. The paperMargins is in mm and the printerMargins is in inch causing the margin compare to fail. I have them both set to inch.

I think you should consider disabling the comparison in 2.2.1, or compare the pagesize only, since it doesn't work properly as it is but that is up to you.

 
Reply | Threaded
Open this post in threaded view
|

Re: Printing Fixed scale issue

dxli
The commit should fix margin comparison using pixels

pclem wrote
So there is still an issue with the margins. The paperMargins is in mm and the printerMargins is in inch causing the margin compare to fail. I have them both set to inch.

I think you should consider disabling the comparison in 2.2.1, or compare the pagesize only, since it doesn't work properly as it is but that is up to you.
12