File->Save As 'Desktop Cutting Plotter' DXF does not scale correctly if a custom viewbox is used.

Bug #1672066 reported by Alvin Penner
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Medium
Alvin Penner

Bug Description

Attached is an svg file with a custom viewbox. The Document Properties Dialog shows the Scale as 25.4. The viewbox is 5334 by 7543.8, much larger than normal for an A4 page. The file is from:
https://bugs.launchpad.net/inkscape/+bug/1660967/comments/14

The blue rectangle in this file is 100mm by 100mm.
Saving this as 'Desktop Cutting Plotter' DXF using a Base Unit of mm in the output dialog yields a dxf file where the rectangle is much too large, 672mm by 672 mm.

The same problem is also encountered in the Python extension: Extensions->Export->Win32 Vector Print

Revision history for this message
Alvin Penner (apenner) wrote :
Revision history for this message
su_v (suv-lp) wrote :

Possibly related to the underlying issue as described in these earlier reports:

Bug #1508400 “inkex.py: support arbitrary (but uniform) document scale (0.92)”
Bug #1525418 “DXF export fixed to 96 dpi, should use user unit scale”

tags: added: dxf exporting viewbox
Revision history for this message
Alvin Penner (apenner) wrote :

attached is a proposed fix for the dxf output.
This uses essentially the same compensation method for viewbox as in hpgl_encoder.py

Revision history for this message
Alvin Penner (apenner) wrote :

attached is a proposed fix for the Extensions->Export->Win32 Vector Print.
this was modified in the same way as for the dxf output above.

Revision history for this message
TylerDurden (8thrule) wrote :

I tested dxf_outlines.py with various scales (uniform) and display units, along with variation in plotter output base units. All resulting dxf files had correct size objects compared to original svg objects.

Looks good!

Cheers,
TD

Revision history for this message
Alvin Penner (apenner) wrote :

good to hear.
committed to rev 15590

Changed in inkscape:
status: New → Fix Committed
jazzynico (jazzynico)
Changed in inkscape:
assignee: nobody → Alvin Penner (apenner)
importance: Undecided → Medium
milestone: none → 0.93
Revision history for this message
Reptorian (reptillia-39) wrote :

I tested it myself using Solidworks import, and I think it works so far. By the way, Alvin, would it possible to automatically insert unit to be used in the name during saving .dxf? Thanks for fixing it, man.

Revision history for this message
Alvin Penner (apenner) wrote :

@Reptorian - glad to hear it is working. As far as the file name is concerned, I do not think that the Python extension is able to change the name in any way. I believe that part of the process is handled by C code over which I have no control.

Revision history for this message
Alvin Penner (apenner) wrote :

a merge request to backport the latest changes in dxf_outlines.py to the 0.92.x branch has been issued at:

https://gitlab.com/inkscape/inkscape/merge_requests/186

Revision history for this message
Alvin Penner (apenner) wrote :

backported to 0.92.x branch in rev:
Inkscape 0.92.2 (0af2471, 2018-01-13)

Patrick Storz (ede123)
Changed in inkscape:
milestone: 0.93 → 0.92.3
Bryce Harrington (bryce)
Changed in inkscape:
status: Fix Committed → Fix Released
Revision history for this message
Gideon Naude (gideonnaude) wrote :

Hi guys, I've been reading about this problem for hours now and trying all the possible suggestions.
I also updated my inkscape version to the latest Inkscape 0.92.4 (5da689c313, 2019-01-14).
I've set the scale to 1, tried all the various units, mm, pt, px, etc. Checked DPI settings (not sure if I did this correctly, but it seems to be under Edit->Preferences->bitmap)?
I have tried installing extensions better-better dxf output and big-blue-saw-output V2.
I also copied the proposed fix in comment 3 into C:\Program Files\Inkscape\share\extentions.
I have made sure that I set objects to paths.
I have tried saving as dxfs after setting paths and objects to have no fill or stroke.

Before giving up on Inkscape I will give this one more go.

Attached, please svg with 100mm square and a 3mm hole.

When I export this and open it in my TruCut lasercutting software I get a 99.7354mm sqaure and a 2.7275 mm circle. I can scale it and combine the line to get a 100mm square, no problem. BUT the 3 mm hole only scales to 2.7347 mm.
I've set the scale in document properties to 0.99735 which gives me 100mm square when importing to TruCut, but the circle inside the square is only 2.7347mm
When drawing a 100mm square in Coraldraw, saving it as dxf and importing it to TruCut, I get the correct size.
Any help please?

Revision history for this message
Gideon Naude (gideonnaude) wrote :

here is the svg

Revision history for this message
Alvin Penner (apenner) wrote :

It looks like your issue is related to the difference between "visual bounding box", which includes stroke width, and "geometric bounding box", which does not. dxf output uses the geometric size.

If you click on the Select tool (F1), and select the rectangle, you will see the visual bbox, which is 100mm. But if you go to Fill & Stroke you will see the stroke width is 0.265mm, which is why the geometric bbox is 99.735mm.

When you draw the rectangle using the tool F4, make sure that the size is 100mm. The F4 tool shows the geometric size, while the F1 tool shows the visual size.

Also, you can always get the correct geometric size of an object using the XML editor at Edit->XML editor.

Revision history for this message
Gideon Naude (gideonnaude) wrote :

Thanks for the quick reply Alvin. I had a look now and drew a 100mm square, setting the size with the F4 tool. You are correct. It seems even of I select all the paths and set it to have no fill or stroke, it still accounts for a stroke width of 0.265mm (or whatever the current stroke width is set to) when saving as a dxf. I will remember to set sizes of objects with the F4 tool instead.
What I also noticed is that the circle (set to size with F4 tool), after importing it to TruCut, shows a 3mm diameter on the y-axis, but only 2.9839mm on the x. Which is much closer than before. Any idea what might cause this? I've attached the dxf file if you'd like to have a look at it.
Is there a way to set the size of a circle's diameter within the F4 tool instead of having to specify rx and ry individualy?

Thanks again Alvin.

Revision history for this message
Alvin Penner (apenner) wrote :

with the circle you will see the same behavior.
- if you use the F5 tool to draw the circle, you will see the geometric bbox, which is what you want to set.
- later on if you use the F1 tool you will see the visual bbox which will be larger
- in your case it appears that you have converted the circle to a path, so at this point it becomes very difficult to edit the size precisely. You will need to change the size before you convert it to a path, using the F5 interface (Rx and Ry).

Revision history for this message
Gideon Naude (gideonnaude) wrote :

Just spent a couple of hours redrawing something I designed, the sizes are now all correct and I will not be making the same mistake again. I think this time I will also save a copy which I can go back to in case it needs to be edited, before converting shapes to paths. Thank you for the help.

Revision history for this message
Alvin Penner (apenner) wrote :

no problem, hope it works. For future reference, there are a few places where you can get good feedback on issues like this:
http://inkscape.13.x6.nabble.com/Inkscape-User-f2857977.html
and
http://www.inkscapeforum.com/viewforum.php?f=31

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.