Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

Dimensions not correct when exported from OnShape

After getting the sizes wrong on a panel I created, I made a test object 7.5cm by 8.5cm in OnShape, exported to dxf and viewed it in eDrawings - The dimensions it shows there are 190.5mm by 215.9mm. There's obviously something really basic I'm doing wrong here, but am really confused, if anyone can help please - thanks!

Best Answers

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,631
    Answer ✓
    DXF is unitless and requires the importing system to provide a way to set the units, but it looks like eDrawings defaults to inches with no way to change it (yay). 

    You can either set your workspace units to inches before exporting or you can create a drawing with the view of the part (which will import into eDrawings correctly). 
    Senior Director, Technical Services, EMEAI
  • tim_hess427tim_hess427 Member Posts: 648 ✭✭✭✭
    edited February 2021 Answer ✓
    I just ran into this issue today. I was trying to quote a laser cut part and exported a dxf from the face of the part. The part studio units are mm, but when I uploaded the dxf to the vendor website, it was interpreted as inches. 

    I couldn't find a $INSUNITS variable, but I did find $MEASUREMENT based on some googling. Changed a 0 to a 1 in a text editor and re-uploaded. Now, my dimensions are correct. 

    https://www.practicalmachinist.com/vb/cad-cam/there-something-dxf-file-header-indicating-mm-inch-units-357982/

    EDIT: Also want to note that I uploaded the same original dxf (before I modified it) to two different vendors. One system asked for the units and scaled the file appropriately. The other did not ask and it was wrong. 

Answers

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,631
    Answer ✓
    DXF is unitless and requires the importing system to provide a way to set the units, but it looks like eDrawings defaults to inches with no way to change it (yay). 

    You can either set your workspace units to inches before exporting or you can create a drawing with the view of the part (which will import into eDrawings correctly). 
    Senior Director, Technical Services, EMEAI
  • alnisalnis Member, Developers Posts: 452 EDU
    edited February 2021
    @NeilCooke The DXF format does specify units in the header variable $INSUNITS, but the problem is that Onshape always writes $INSUNITS as 1, representing inches, while the numerical values representing geometry are in the workspace's units, so scaling is only correct when the workspace units are inches. DXFs are only unitless when $INSUNITS is written with value 0.

    DXF specification (Autodesk seems to move the documentation around semi-regularly, so I'm also putting in a link to a downloadable PDF):
    http://help.autodesk.com/view/OARX/2018/ENU/?guid=GUID-A85E8E67-27CD-4C59-BE61-4DC9FADBE74A
    https://images.autodesk.com/adsk/files/autocad_2012_pdf_dxf-reference_enu.pdf

    As a workaround, you can switch workspace units to inches, export, then switch workspace units back, and then the DXF should have correctly scaled units.

    Edit: looks like I am wrong about the DXF format having units; $INSUNITS does not seem to apply to the whole DXF, but rather seems to be a hint for editors for what scaling to use when inserting additional content into the drawing. Link to the comment in this thread here: https://forum.onshape.com/discussion/comment/70565/#Comment_70565
    Get in touch: contact@alnis.dev | My personal site: https://alnis.dev
    @alnis is my personal account. @alnis_ptc is my official PTC account.
  • dirk_van_der_vaartdirk_van_der_vaart Member Posts: 547 ✭✭✭
    Never had problem's with exporting from the Part studio, select a face and RMB , select export DXF/DWG.

  • tim_higham442tim_higham442 Member Posts: 3
    Very interesting - thank you for that. Even something as simple as keeping everything as millimetres is not quite that simple! I'll try that workaround - Thanks for your help.
  • tim_hess427tim_hess427 Member Posts: 648 ✭✭✭✭
    edited February 2021 Answer ✓
    I just ran into this issue today. I was trying to quote a laser cut part and exported a dxf from the face of the part. The part studio units are mm, but when I uploaded the dxf to the vendor website, it was interpreted as inches. 

    I couldn't find a $INSUNITS variable, but I did find $MEASUREMENT based on some googling. Changed a 0 to a 1 in a text editor and re-uploaded. Now, my dimensions are correct. 

    https://www.practicalmachinist.com/vb/cad-cam/there-something-dxf-file-header-indicating-mm-inch-units-357982/

    EDIT: Also want to note that I uploaded the same original dxf (before I modified it) to two different vendors. One system asked for the units and scaled the file appropriately. The other did not ask and it was wrong. 
  • alnisalnis Member, Developers Posts: 452 EDU
    Huh, DXFs from Onshape still show the $INSUNITS variable for me when I export. Maybe it depends on what you are exporting? I also found the $MEASUREMENT variable, but unfortunately changing it didn't make the quoting software I was using correctly interpret the data. I still had to change the $INSUNITS variable from 1 to 4 to get it to get the scaling right (the DXF was exported with workspace units set to mm).

    Get in touch: contact@alnis.dev | My personal site: https://alnis.dev
    @alnis is my personal account. @alnis_ptc is my official PTC account.
  • tim_hess427tim_hess427 Member Posts: 648 ✭✭✭✭
    @alnis_smidchens - That's weird. I did a little more digging and found this post: 

    https://forums.autodesk.com/t5/autocad-forum/units-settings-within-dxf-files/td-p/7417774

    It looks like $INSUNITS and $MEASURMENT variables apply to different things. Based on the above post, it sounds like $INSUNITS is probably only used when it's needed for some sort of attached object. And it looks like $MEASUREMENT is being incorrectly used by some vendors to guess the original drawing units when it really only applies to lines and hatching properties. 

    In the end, it looks like @NeilCooke is right in that DXF is supposed to be unitless, but different implementations of import software use workarounds to try to assume what the original units were - which causes issues when they're wrong. 
  • alnisalnis Member, Developers Posts: 452 EDU
    Huh. Very interesting! Looks like I was wrong then! Sorry for not looking into this more before posting!

    I guess since it's the "drawing-units value for automatic scaling of blocks, images, or xrefs when inserted or attached to a drawing" it might be reasonable to assume that the scale applies to existing geometry too? I'm not really sure. I haven't used a 2D CAD system before, so I don't know what the standard practices/conventions are. In any case, it does seem to be that a lot of vendors use it for scaling DXFs in their quoting systems.


    Get in touch: contact@alnis.dev | My personal site: https://alnis.dev
    @alnis is my personal account. @alnis_ptc is my official PTC account.
  • tim_hess427tim_hess427 Member Posts: 648 ✭✭✭✭
    It was an interesting rabbit hole for me to dive into on a Wednesday. Learned something new and now know at a trick for fixing DXFs that don't import to things correctly :)
  • paweł_kucmuspaweł_kucmus Member Posts: 8 PRO
    edited April 2021
    @NeilCooke I ran into this today and indeed it is confusing. DXF spec https://images.autodesk.com/adsk/files/autocad_2012_pdf_dxf-reference_enu.pdf - page 20 describes `$INSUNITS` (`1` for inch and `4` for mm) but does not explicitly say how to use it.

    The end result is that my DXF files (made in a millimeter workspace) have proper values but some reader software read my 500mm as 500inch as all Onshape DXF exports have the $INSUNITS set to `1`. 

    If Onshape wants to stick to unitless DXFs that value should probably be set to `0` which the spec defines as `Unitless`.

    What do you think?
  • matthew_stacymatthew_stacy Member Posts: 487 PRO
    Hmpf!  Lots of discussion, but units for DXF export/import seem baffling and buggy to me.  If my Onshape workspace units are set to mm , at the time of export, then the DXF will scale correctly.  If my workspace units are set to inches the DXF is at 1/25.4 scale.

    Goofy.

    I would strongly advise importing any DXF files that you export to confirm that the size is correct ... to avoid serious disappointment when FedEx brings your tiny-scale models back from the laser cutter.
  • elizabeth_giovanardielizabeth_giovanardi Member Posts: 21 EDU
    Hi all,
    I am running into a similar issue and cannot seem to use your solutions with any success. I have a part studio whose units are set to inches. When I export the dxf (in 2018 on the export window) and import into cricut design space (yes the little craft maker device), it imports it really large. So I changed to workspace units to mm and did it all again. Still really large. So I then opened AutoCAD to try importing using a more official CAD software and the import is still really large. I am trying to cut gears using craft foam, and gears need to be exact sizes, so this is becoming a struggle. I prefer not to simply guess the scaling factor. Any help? Thanks!
    Here is a link to the public gear train document:
    https://cad.onshape.com/documents/170b40f8502a593f6a6102be/w/6913f3b44a59b911d5f18473/e/232942776414fc02e9f531a9

  • wayne_sauderwayne_sauder Member, csevp Posts: 546 PRO
    edited May 2022
    @elizabeth_giovanardi
     What exactly is your workflow when exporting? I just opened your document, right-clicked on a face, and exported it as a 2018 DXF, I then opened it with eDrawings and double-checked dimensions and everything is correct. I would check the settings of the software you're importing into. 
  • S1monS1mon Member Posts: 2,839 PRO
    DXF and STL are both very popular CAD file formats. The other thing that they have in common is that they don't specify the units. The amount of money and time that has been wasted in the world because of this is insane. 

    Make sure to tell whomever is importing a DXF what units were used for exporting. As an extra check, add some reference feature and call out that it's 10mm (or another appropriate round number) long.
  • paweł_kucmuspaweł_kucmus Member Posts: 8 PRO
    S1mon said:
    DXF and STL are both very popular CAD file formats. The other thing that they have in common is that they don't specify the units. The amount of money and time that has been wasted in the world because of this is insane. 

    Make sure to tell whomever is importing a DXF what units were used for exporting. As an extra check, add some reference feature and call out that it's 10mm (or another appropriate round number) long.
    Please check my comment on https://forum.onshape.com/discussion/comment/72251/#Comment_72251, Onshape always exports with the dimensions set to that the document is set to - to make sure I'm making sense, if I have a line in my drawing or sketch that has 500mm, the resulting DXF will say 500 (no unit) then in that $INSUNITS header it will say "1" for inches, so some software will load that line as 500 inch.
  • kristof_onghenakristof_onghena Member Posts: 19 PRO
    I have never had issues with this until now  :( 
    This is sad to see that it exports it wrong. It can't be that hard for Onshape to set $INSUNITS correctly depending on the part studio unit settings.... 
  • Rick_BoermaRick_Boerma Member Posts: 7
    I have the same issue. I can solve it by changing line 892 (MEASUREMENT) in the DXF file from 0 to a 1, then saving the DXF file. 
    (See https://ezdxf.readthedocs.io/en/stable/concepts/units.html#measurement
     


    Post / thread is similar to:
    https://forum.onshape.com/discussion/17533/dxf-export-issues 
  • Rick__BoermaRick__Boerma Member Posts: 2
    It seemed to be solved now :)
Sign In or Register to comment.