KiCAD unit issues with DXF files exported from FreeCAD

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
Post Reply
User avatar
shiftee
Posts: 30
Joined: Mon Jul 10, 2017 8:43 am

KiCAD unit issues with DXF files exported from FreeCAD

Post by shiftee »

I've no experience in this topic but I came across this in the KiCAD forum.

They are having issues with DXF files exported from FreeCAD.
It seems FreeCAD DXF export does not add $LUNITS and $INSUNITS both of which are needed for correct importing into KiCAD.

https://forum.kicad.info/t/units-once-m ... e/10844/20

Should I create a bug report?
User avatar
wandererfan
Veteran
Posts: 5988
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: KiCAD unit issues with DXF files exported from FreeCAD

Post by wandererfan »

I can't tell from this post which Dxf exporter is being used in FC. There are 2 - "legacy" and "new". I know the new one does not have support for units yet. Not sure about the old one.

Any chance we can find out from KiCAD which one was used?
(Note the legacy "importer" also handles exports)
DxfOptionsInFC.png
DxfOptionsInFC.png (98.28 KiB) Viewed 2867 times
User avatar
easyw-fc
Veteran
Posts: 3580
Joined: Thu Jul 09, 2015 9:34 am

Re: KiCAD unit issues with DXF files exported from FreeCAD

Post by easyw-fc »

wandererfan wrote: Fri May 25, 2018 2:14 pm
I can't tell from this post which Dxf exporter is being used in FC. There are 2 - "legacy" and "new". I know the new one does not have support for units yet. Not sure about the old one.

Any chance we can find out from KiCAD which one was used?
(Note the legacy "importer" also handles exports)
I'm not sure if the exporter depends on the 'legacy' setting...
here what I get from the python console:

Code: Select all

import importDXF
importDXF.export(__objs__,u"C:/Temp/step-cadexchanger/internal.dxf")
__objs__.append(FreeCAD.getDocument("Unnamed").getObject("Shape2DView"))
...
import importDXF
importDXF.export(__objs__,u"C:/Temp/step-cadexchanger/legacy.dxf")
If I change the option, I get exactly the same result (I'm using File, Export, 'Save as Type':Autodesk DXF)
legacy.dxf
(1.3 KiB) Downloaded 108 times
internal.dxf
(1.3 KiB) Downloaded 93 times
User avatar
wandererfan
Veteran
Posts: 5988
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: KiCAD unit issues with DXF files exported from FreeCAD

Post by wandererfan »

I took a quick look through Draft/importDXF.py and I didn't see anything obvious related to units.

Looks like we need an issue report.
User avatar
easyw-fc
Veteran
Posts: 3580
Joined: Thu Jul 09, 2015 9:34 am

Re: KiCAD unit issues with DXF files exported from FreeCAD

Post by easyw-fc »

wandererfan wrote: Fri May 25, 2018 6:54 pm I took a quick look through Draft/importDXF.py and I didn't see anything obvious related to units.

Looks like we need an issue report.
done here:
https://www.freecadweb.org/tracker/view.php?id=3494
User avatar
easyw-fc
Veteran
Posts: 3580
Joined: Thu Jul 09, 2015 9:34 am

Re: KiCAD unit issues with DXF files exported from FreeCAD

Post by easyw-fc »

wandererfan wrote: Fri May 25, 2018 6:54 pm I took a quick look through Draft/importDXF.py and I didn't see anything obvious related to units.

Looks like we need an issue report.
following the KiCad forum:
The fun you find while digging into obscure specifications

$INSUNITS was introduced in the “Autocad 2000” specification for DXF.

This means any export methods set to AC1006 = R10, AC1009 = R11 and R12, AC1012 = R13 or AC1014 = R14. Will not have that tag present if the tool is respecting the export option,

Freecads export is for AC1009 / R12, so it will never include that tag so long as they are following the specification, and to include it would involve them remaking the exporter to support whatever the Autocad 2000 version is.

Before this, It was simply that DXF files where unitless, Most tools like solidworks and Autocad assumed this to be in inches if not specified on import,
ickby
Veteran
Posts: 3117
Joined: Wed Oct 05, 2011 7:36 am

Re: KiCAD unit issues with DXF files exported from FreeCAD

Post by ickby »

I had this issue once too. Back than it turned out the DXF version freecad exports does not use units, it is not in this versions standart. You can check the version by the DXF file header, there is a identifier which you can than relate to the spec version.

The conclusion back than was, that the error is on the importing software site: it needs to check the specification version of the DXF and use units only when supportet by it.

Don't know if this is still valid though it if freecad has upgraded the DXF version.
rawrpenguinzombies
Posts: 9
Joined: Mon Sep 10, 2018 7:50 pm

Re: KiCAD unit issues with DXF files exported from FreeCAD

Post by rawrpenguinzombies »

I am willing to offer a reward to whoever fixes this issue and the related 3594 issue tracker id.
User avatar
Kunda1
Veteran
Posts: 13443
Joined: Thu Jan 05, 2017 9:03 pm

Re: KiCAD unit issues with DXF files exported from FreeCAD

Post by Kunda1 »

Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
wmayer
Founder
Posts: 20074
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: KiCAD unit issues with DXF files exported from FreeCAD

Post by wmayer »

https://github.com/FreeCAD/FreeCAD/pull/6830 adds the unit block to header14.rub file

When I create a sketch and export it as .dxf then e.g. VariCAD viewer no longer prints a warning about the missing units.
Post Reply