File->Save As 'Desktop Cutting Plotter' DXF does not scale correctly if document units are not px.

Bug #1660967 reported by Alvin Penner on 2017-02-01
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Alvin Penner
Alvin Penner

Bug Description

This is essentially the same bug as Bug 1660474, but applied to dxf output.

Attached are two svg files. The first one uses px as a document unit. This outputs at the correct size on a printer, if one chooses the option Base Unit = mm in the output dialog.

Alvin Penner (apenner) wrote :
Alvin Penner (apenner) wrote :

The second one uses mm as a document unit. This outputs at a size that is significantly too small on a printer, if one chooses the option Base Unit = mm in the output dialog.

(This output can be artificially made to be the correct size if one chooses the Base Unit to be px, but it should not be necessary to do so. The correction for the change in the svg document unit should occur automatically)

Alvin Penner (apenner) wrote :

attached is a proposed fix for this.
I'll leave this here for testing purposes for a few days, and if there is no objection, I'll commit it on the weekend

jazzynico (jazzynico) on 2017-02-02
tags: added: dxf exporting extensions-plugins units
Changed in inkscape:
assignee: nobody → Alvin Penner (apenner)
importance: Undecided → Medium
milestone: none → 0.93
status: New → In Progress
jazzynico (jazzynico) wrote :

Patch from comment #3 tested successfully on Windows XP (32-bit), lp:inkscape/0.92.x rev. 15351.
Exported files tested with LibreCad 2.1.3.
Thanks Alvin!

Alvin Penner (apenner) wrote :

thanks for testing!
committed to rev 15469

Changed in inkscape:
status: In Progress → Fix Committed
jazzynico (jazzynico) wrote :

Fixed in lp:inkscape/0.92.x rev. 15390.

TylerDurden (8thrule) wrote :

I believe this bug is related to the one I posted recently:
Default.svg using mm as units and scale of 1 causes problems

This seems to originate further upstream, as the output scaling issue also applies to inches in the display units and inches as base unit for plotter export. (not just a mm issue). Similarly, symbols generated in >=0.92 with the default.svg (mm, scale 1)

Looking at the default.svg files packaged with 0.92.0, 0.92.1 Win 64bit, they all have the scale set to 1.

This is inconsistent with the change to 96dpi (excl px as the display unit). For svg compliance and consistency with 96dpi, scale on default.svg documents should have scale as follows:

1:1 == px:px
96:1 == px:in
3.77953:1 == px:mm
1.333:1 == px:pt

This bug #1660967 is resolved by (properly) setting scale to 3.77953, without the need to modify the plotter output routine. It may be that the updated plotter routine corrects the erroneous scale setting, but does not address what I believe to be the root of the issue and other size issues. (I cannot test the updated build/routine locally, my machines are currently in use by students.)

Attached are files:

1 inch square object in an Inkscape document having inches as display units and scale of 1.
(Svg document opens in other svg editors with the object size 1px (1/96").)

Resulting dxf ouput with inches as base units.
(The resulting dxf is 0.0104" or ~1/96 the proper size.)

1 inch square object in an Inkscape document having inches as display units and scale of 96.
(Svg document opens in other svg editors with the object size 96px (1").)

Resulting dxf ouput with inches as base units.
(The resulting dxf is 1", the proper size.)

If we are intent on making a smooth transition to 96dpi, it might be a good idea to setup the default documents with scales that correspond to the standard. While the scale/viewbox tools in the Document Properties provides a means to correct for legacy documents, it also exposes an area for error having global detrimental effect if the initial scales provided in the default.svg documents are not consistent with 96dpi. [/opinion]


TylerDurden (8thrule) wrote :
TylerDurden (8thrule) wrote :
TylerDurden (8thrule) wrote :
Alvin Penner (apenner) wrote :

- using the file 1in_sq_Display_inches-Scale_1.svg from comment 7
- using Inkscape 0.92.1 r15371
- save as dxf using the Base Unit mm
- get a dxf file with a rectangle whose sides are .26 mm long, which is much too small

- using trunk Inkscape 0.92+devel 15563
- perform the same sequence using the same Base Unit
- get a dxf file with a rectangle whose sides are 25.4 mm long, as expected

these results are consistent with comment 6 of Bug 1670913
to the best of my knowledge this version of the code has not yet been released, so it would be necessary to get it from trunk in order to test:

TylerDurden (8thrule) wrote :


I appreciate that the updated can correct the output of mis-scaled Inkscape documents, however:

This updated code does not address the larger issue of scale set in the default.svg packaged in the Win releases (and likely others). If the scale in the Document Properties panel is set in accordance/compliance with 96dpi, the output size of plotter files and other filetypes is not an issue.

Scale in in the Document Properties panel should be set to 1, only in the case of display units == px.


Alvin Penner (apenner) wrote :

    since the scope of this question is larger than the current bug report, it might be interesting to post it on the developer or user mailing list:
    I have more or less made a solemn vow never to get involved in scaling discussions ever again, since the last time I spoke on the issue I got a bit too involved with my own rhetoric and lived to regret it. So I have no comment other than to state the obvious, which is that there is a certain amount of mathematical redundancy in the Inkscape representation of scaling information, so one is more or less free to choose whichever method is most intuitive or most intellectually appealing. My own method is to choose a specific template file from the Inkscape\share\templates\ directory and then use that template file for all future work. This could also include, potentially, customizing your template file with your own scale factor as well.

TylerDurden (8thrule) wrote :

Hi Alvin,

Thank you for your insights. I understand the scale issue is complicated and opinions differ on how to approach the recent changes.

I tested the above with a 100mmsq rectangle path, and got varying results with changes of scale. I was hoping the output processing would have corrected or accounted for variation in scale, but it seems changes in scale set in the properties panel change the dxf output size. All were output using mm as base unit in the plotter output dialog.

So, it seems the upstream scale issue cannot be avoided, or at least a more elaborate output routine would be needed to deliver accurate output regardless of scale setting in the document properties panel. Which, I believe is possible.

But the updated is really not needed, if scale is set properly in the document properties panel, as I have described above.

Feel free to contact me directly if you like with your thoughts on these results.

Attached are test files in a zip archive: three svg files and three resulting dxf files.

100mmsq rectangle with units mm and scale 1
100mmsq rectangle with units mm and scale 3.77953
100mmsq rectangle with units mm and scale 25.4


Alvin Penner (apenner) wrote :

thanks for the files. I don't think that I have ever attempted to account for changes in the (viewbox) scale factor in the dxf output. So far the only change made was to compensate for changes in the document-units setting. So I will take a look and see if the viewbox can be included in the calculation as well.

Alvin Penner (apenner) wrote :

Since this report has already been marked as Fix Committed we cannot now add to it.
The issue of compensating for changes in the viewbox size has been reported separately as Bug #1672066.

A proposed solution to that bug will be posted there shortly.

Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers