Inkscape.org
Beginners' Questions How to export DXF with correct scale? DXF is exported with incorrect size/scale
  1. #1
    Christopher Christopher @cmbuck

    Hello,

    I'm having a world of a time trying to get inkscape to export DXF files in any predictable way.

    Steps to reproduce:

    • Create new file
    • Open Document Properties
      • Set display units to mm
      • Set page size to A4
      • Set the "custom size" units to mm
      • Set the "scale" to 1 (since the "user units" are in mm, 1mm=1mm)
    • Draw a rectangle, set the units to 100mm x 100mm
    • File > Save a Copy > "100mmRect.dxf"
      • Don't use Robo-master
      • Do use LWPOLYLINE
      • Base Unit "mm" (as this is the unit everything else is in)
    • File > Import > "100mmRect.dxf"
      • Select "Manual Scale"
      • Manual Scale Factor = 1
      • Select "Include SVG as editable object(s)..."
      • DPI 96

    Expected outcome: A copy of the original 100mm x 100mm square is now in the file.

    Actual output: A new grossly incorrect size square of dimensions 375.887mm x 375.887mm is in the file.  Screenshot attached.

    System information: Running Inkscape 1.1 (c68e22c387, 2021-05-23), Windows 10 64-bit.  MSI installer.

    What gives?  Why can't Inkscape correctly export the scale of the original image?  I have confirmed that other tools also interpret the exported dxf with severely incorrect dimensions, so this appears to be an export issue, not an import issue.

    Yss5Ynojfk
  2. #2
    Tyler Durden Tyler Durden @TylerDurden
    *

    I'd try units=mm, scale=3.77953.

     

  3. #3
    Aero Aero @Aero◻️
    *

    I tested with mm scale of 1 and 10.
    Seems like a bug in 1.1. Both works fine in 1.0.2.

    Not fixed in 1.1.1 and Inkscape 1.2-dev (03e16dd8, 2021-09-24)

     

    Svg2Dxf 254Dpi Mm
  4. #4
    Tyler Durden Tyler Durden @TylerDurden
    *

    This might have been fixed, but not yet released. https://gitlab.com/inkscape/extensions/-/issues/388

    Or, maybe just the issue with rectangles. Converting to path is a workaround.

  5. #5
    Christopher Christopher @cmbuck

    Thanks for the responses.  @Aero , I have not yet tried older versions of Inkscape, but I plan to try that next.  I'll try out 1.0.2 since you report it seems to be working there.

    @TylerDurden I tried the workaround converting the square to a path, and while this did help, the dimensions are still off.  Each side comes in at 99.648mm instead of 100mm, so it seems that there is still some scaling factor erroneously being applied.  (See screenshot attached.)  How can we get those to match?

    Inkscape Cs2Ilz0Dcb
  6. #6
    Tyler Durden Tyler Durden @TylerDurden
    *

    Most likely due to stroke width on the original being included in the total dimension.

    I'd use no stroke and View>Display mode>Outlines, or switch the setting in Preferences>Tools>Bounding box>Geometric.

  7. #7
    Christopher Christopher @cmbuck

    Man, it feels like we're really close to working around this issue.  I changed the display mode to Outlines as you suggested and removed the stroke from the original.  But then when I import that version (100mm square, converted to paths, no stroke width), it comes in at 100.265mm.  It looks like the extra .265mm comes from the stroke width added to the copy that was imported, but the boxes are disabled, preventing me from editing the stroke width of the imported square. 

    The good news is that it appears this last 0.265mm issue is on the Inkscape Import side, rather than the export.  Another DXF tool now reads that the 100mm square is indeed 100mm when converted to a path and exported without any stroke widths, so that's good progress.

    Inkscape J9Rh9Psup7
  8. #8
    Tyler Durden Tyler Durden @TylerDurden
    *

    The boxes may be disabled if the objects are in a group. The rectangle may be a group of four discrete paths.

    The information area of the status bar at the bottom of the screen will indicate the nature of the object, when the object is selected. 

    The group can be "entered" by double clicking on a line, or it can be ungrouped.

    http://tavmjong.free.fr/INKSCAPE/MANUAL/html/Groups.html

  9. #9
    Christopher Christopher @cmbuck

    Very interesting.  Double clicking the imported square (which appears to be imported as a group of 4 paths as you suggest, as far as I can tell) has mixed results.  Whether I'm able edit the stroke width appears to be dependent on the precise timing of the double click, combined with the precise location of the cursor at the time of the clicks.  So this method is a bit hit or miss for me.  However trying your suggestion led me to find that clicking the imported object using the "Edit paths by nodes" tool (hotkey "N") allows me to deterministically enable the option to edit the stroke width.  I believe this is also "entering" the group?

     

    Thanks @TylerDurden for your help working around this bug.  Before I export my projects to DXF, I'll try saving, then converting all the shapes to paths instead of objects, and editing their stroke widths to be 0.

Inkscape Inkscape.org Inkscape Forum Beginners' Questions How to export DXF with correct scale? DXF is exported with incorrect size/scale