Inkscape.org
Beginners' Questions export SVG to DXF with dimension?
  1. #1
    roni.segoly roni.segoly @roni.segoly

    Hi

    I created svg file (recatngle 100X200 mm)

    Saved as DXF 

    And then import the DXF with the option of read scale from file, but the imported one is different dimetions (very small)

    How can I maintain the dimentions? 

  2. #2
    brynn brynn @brynn

    First you have to have the Scale set properly in Document Properties.  For units in mm, that Scale should  be set to 3.77953.

    You might have to either re-draw the rectangle, or scale it to the proper size, after making that change.

    If that was not the problem, or if you still have the wrong size results after making those changes, we'll need to investigate further.  Possibly the native resolution of Inkscape and the software where you're using the DXF image could be different.  Or maybe something else.  But one step at a time.

  3. #3
    roni.segoly roni.segoly @roni.segoly

    for first note, I changed the scale to be 3.77953 (is it as attached?) 

    I tried then importing xdf to same inkscape, but I get smaller image (see attached)

    Screenshot 2020 01 16 10.47.07
    Screenshot 2020 01 16 10.44.40
  4. #4
    brynn brynn @brynn

    Before you imported the DXF, did you check the rectangle was the right size, after changing the scale?  Because if the scale was different than 3.77953 when you created the rectangle, the rectangle probably changed size and needs to be fixed.

    Here's the routine:

    • set the Scale properly (as you did)
    • make sure the rectangle is still the right size, and if not, fix it
    • either save a new DXF file, or overwrite the first one

    Now when you open the DXF file in Inkscape, it should be the same size as when you saved it.

    Oh, actually I see that's not really a rectangle.  But you can still scale it if necessary.  You should not have to draw it again.  (I just suggested re-drawing because a rectangle is very fast to draw.)

  5. #5
    roni.segoly roni.segoly @roni.segoly

    I changed scale in SVG and needed to change the rectangle size

    I overwritten teh DXF

    I opened new document, changed scale and then imported DXF, still small

     

    BTW how do save properties like scale to be default?

  6. #6
    Tyler Durden Tyler Durden @TylerDurden
    roni.segoly

    BTW how do save properties like scale to be default?

    Set the document properties to the desired values, then save as default.svg to your user templates file: C:/Users/your-username/AppData/Roaming/Inkscape/Templates.

     

    Here is a round-trip: Inkscape>DXF>Inkscape.

     

     

  7. #7
    brynn brynn @brynn
    *

    Ok, let's make sure we're both doing the same thing.  I see you're using 1.0 beta.

    When you save the DXF file, are you using DXF12 or DXF14 ?  If using 14, do you choose ROBO-Master or LWPOLYLINE option, or both or neither? 

    Are you opening or importing back into Inkscape?  Or into some other software?

    Using 12, opening my DXF file in Inkscape, it appears to be blank.  There are no objects visible or selectable.  Using 14 (neither ROBO or LWPOLYLINE checked on save), it saves the paths of the rectangle, but they aren't connected.  They are just 4 paths in the shape of a rectangle.  Notably, whether I use Manual Scale or Read from File, the rectangular paths are 4 times larger than the original rectangle!  (A 2nd test with a star shape, the paths in the DXF file are approx 7 times larger than the original!)

    Note that I'm using px, but I don't think that should matter for this test.  So unless there's something fundamental about DXF that I don't understand, this would be unexpected, and possibly a bug.

    For comparison and testing, would you please share either your SVG or DXF file?  Or even both, if you saved an SVG?

    Edit

    Oops, TD posted while I was typing.

    Edit #2

    Inkscape's native unit is mm.  So to make sure the Scale is set properly, you don't need to do anything to keep it that way.  But if there are other things you want to customize in your default, you can make either a custom default document or a special template.  (Those are almost the same thing.)  Here's a tutorial:  http://libregraphicsworld.org/blog/entry/using-templates-in-inkscape

  8. #8
    roni.segoly roni.segoly @roni.segoly

    cheers

    I think there is less point in trying to resolve issues when using beta version.

    I wil revert to official realse

  9. #9
    roni.segoly roni.segoly @roni.segoly

    i n official release all working well

  10. #10
    brynn brynn @brynn

    Ok, that sounds like good news for now!

    Maren or anyone else following this.  Should this be reported for 1.0 beta?  Or is it already known?

    I have not searched, because I'm confused exactly where to search in GL.  I know about the Inbox account.  But after some time, bugs are moved to Issues somewhere else, and I'm not sure where that is.

  11. #11
    Maren Hachmann Maren Hachmann @Moini

    The problem hasn't been described with enough detail yet to know whether it's a bug or not. Could be just a different default template - or could be the dxf import extension being broken in some way. What we'd need first would be a step-by-step description of how to reproduce this. Then we'd need to actually be able to reproduce it, to exclude any local reasons.

  12. #12
    brynn brynn @brynn
    *

    Using 1.0beta2 (1.0beta2 (1c3732b, 2019-12-09)) on Windows 7 Pro, 64-bit and attached dxftest.svg

    1. Draw a rectangle 100 px height x 300 px wide
    2. Save As DXF 12 or 14 (no options are selected in the dialog)
    3. Close the file.  (attached dxftest1.dxf)
    4. Open that DXF file in Inkscape (read scale from file)
    5. The rectangle is no longer inside the page borders.
    6. The rectangle is now 542.632 px height x 1457.818 px wide

     

    When I tested the other day, I had different results for DXF 12.  But now, I get the same results for both DXF 12 and 14.

  13. #13
    Maren Hachmann Maren Hachmann @Moini

    Confirmed, dxf 12 is empty, dxf 14 changes the square's size (in my case, using mm and 'read from file', it was shrunk) and moves it to a different place.

  14. #14
    brynn brynn @brynn
    *

    I'll make a bug report.

    https://gitlab.com/inkscape/inbox/issues/1647

     

  15. #15
    Tyler Durden Tyler Durden @TylerDurden
    *

    I would not expect DXF r12 to have a readable scale; $MEASUREMENT is not part of the spec for that dxf version. (spec attached below)

    DXF is regularly regarded as a unitless format. That said, the file headers can carry some unit and scale information, but it can vary from version to version.

    I suggest testing import/export workflows that provide reliable results with the other software being used.  

    LibreCad edits DXF natively and has a few choices of DXF version to save-as, so it can be helpful for conversion.

     

     

     

    If there is an Inkscape "native unit",  it would be the "user unit", which has a 1:1 scale relationship with the SVG standard pixel, which is set currently at 96/in.

     

    Have a nice day.

    TD

  16. #16
    Alvin Penner Alvin Penner @apenner

    for the Inkscape 1.1-dev branch, a patch has been applied to make it compatible with Inkscape 0.92.4.

    see https://gitlab.com/inkscape/extensions/issues/174

    and https://gitlab.com/inkscape/extensions/commit/959619d12736c9742b7b2dc175b85fffd30ae269

  17. #17
    Alvin Penner Alvin Penner @apenner

    the code for the 1.1beta branch has been modified again to make the scaling compatible with 0.92.4.

    if you are using this branch, please re-test using the latest extension code at:  

    https://gitlab.com/inkscape/extensions/

    - also, the reason that DXF 12 sometimes returns an empty file is because it does not support the <rect> tag or the <circle> tag, it only supports the <path> tag.

     

  18. #18
    brynn brynn @brynn
    apenner

    - also, the reason that DXF 12 sometimes returns an empty file is because it does not support the <rect> tag or the <circle> tag, it only supports the <path> tag.

    Aaahh, that explains my confusing results!

    Will have to try and remember that for the future.  But unfortunately, probably won't remember  🤔

  19. #19
    Maren Hachmann Maren Hachmann @Moini

    I guess it would make sense to either auto-convert those elements or to warn the user.

  20. #20
    volatile volatile @volatile

    if font utf-8, all ok,

    but not the correct resize, a circle with a diameter of 1000mm turns out to be 996.169, with 3.77953
    Error Dxf
  21. #21
    Maren Hachmann Maren Hachmann @Moini

    @volatile Bug report link is https://inkscape.org/report - the forum will not be useful for bug reports.

  22. #22
    Tyler Durden Tyler Durden @TylerDurden

    @volatile, it is not clear if there is a stroke on the Inkscape object, and/or if the bounding box is set to "visible".

    Please share the Inkscape svg file or a complete screenshot.

Inkscape Inkscape.org Inkscape Forum Beginners' Questions export SVG to DXF with dimension?