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: 3,891
    Accepted 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). 
    Director, Technical Services, EMEAI
  • tim_hess427tim_hess427 Member Posts: 576 PRO
    edited February 24 Accepted 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: 3,891
    Accepted 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). 
    Director, Technical Services, EMEAI
  • alnisalnis Member, Developers Posts: 370 EDU
    edited February 24
    @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
    Onshape Intern | Get in touch: [email protected] | My personal site: https://alnis.dev
  • dirk_van_der_vaartdirk_van_der_vaart Member Posts: 114 ✭✭✭
    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: 576 PRO
    edited February 24 Accepted 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: 370 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).

    Onshape Intern | Get in touch: [email protected] | My personal site: https://alnis.dev
  • tim_hess427tim_hess427 Member Posts: 576 PRO
    @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: 370 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.


    Onshape Intern | Get in touch: [email protected] | My personal site: https://alnis.dev
  • tim_hess427tim_hess427 Member Posts: 576 PRO
    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: 7
    edited April 20
    @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: 290 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.
Sign In or Register to comment.