pcbnew: Plot dxf - allow metric units

Bug #1832188 reported by Grzegorz Obuch
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KiCad
Fix Released
Low
Ian McInerney

Bug Description

On current nightly version dxf is generated in inch.

Application: Pcbnew
Version: (5.1.0-908-g003544545), release build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.61.1 OpenSSL/1.1.1 (WinSSL) zlib/1.2.11 brotli/1.0.6 libidn2/2.0.5 libpsl/0.20.2 (+libidn2/2.0.5) nghttp2/1.34.0
Platform: Windows 8 (build 9200), 64-bit edition, 64 bit, Little endian, wxMSW
Build Info:
    wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8)
    Boost: 1.68.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.61.1
    Compiler: GCC 8.2.0 with C++ ABI 1013

Build settings:
    USE_WX_GRAPHICS_CONTEXT=OFF
    USE_WX_OVERLAY=OFF
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_PYTHON3=OFF
    KICAD_SCRIPTING_WXPYTHON=ON
    KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=ON

Tags: dxf pcbnew
Seth Hillbrand (sethh)
Changed in kicad:
importance: Undecided → Wishlist
status: New → Triaged
summary: - pcbnew: Plot dxf - units changed to inch
+ pcbnew: Plot dxf - allow metric units
Revision history for this message
Seth Hillbrand (sethh) wrote :

Right now all units in the dxf plotter are "english" units (which apparently to DXF means inches). It would be helpful to know why a different internal unit is needed in the file.

Revision history for this message
Grzegorz Obuch (grzegorzobuch) wrote :

I noticed this only because of the change compared to files generated in stable versions.

For me natural units are metric units, for my clients and suppliers too. If this change is permanent, I will have to re-scale the files after generation to avoid ambiguity.

Revision history for this message
Seth Hillbrand (sethh) wrote :

The internal size of the files should not change. There was a bug in 5.1.2 that scaled the output incorrectly into mm. This has been fixed for 5.1.3 (should be released in July)

When fixing this, we first tried to modify the file output to handle mm but this was not read correctly by many DXF import routines (e.g. QCAM or Inkscape). Instead, we scale our output to provide internal units of inches. This means that the document has internal format in inches but should not require re-scaling as the physical size matches the physical size in pcbnew.

Revision history for this message
Seth Hillbrand (sethh) wrote :

For future developer reference, this was changed in 85b8dd8b3

https://git.launchpad.net/kicad/commit/?id=85b8dd8b3

tags: added: dxf
Revision history for this message
Grzegorz Obuch (grzegorzobuch) wrote :

For clarification - for me internal units are irrelevant.
I tested stable versions 5.1.0 5.1.1 and 5.1.2 in each of them the dimension measured in another CAD program is the same as in kicad.
In dxf exported from the latest nightly version(5.1.0-912-g7ebda0247) everything is 25.4 times smaller.
In the attachment, the 10mm dimension is from kicad.

Revision history for this message
Grzegorz Obuch (grzegorzobuch) wrote :
Revision history for this message
Grzegorz Obuch (grzegorzobuch) wrote :

Dxf ploted in the last nightly.

Revision history for this message
Grzegorz Obuch (grzegorzobuch) wrote :

..from stable 5.1.1

Revision history for this message
Seth Hillbrand (sethh) wrote :

What is the other CAD program you are using?

Changed in kicad:
importance: Wishlist → High
milestone: none → 5.1.3
assignee: nobody → Seth Hillbrand (sethh)
status: Triaged → Incomplete
Revision history for this message
Grzegorz Obuch (grzegorzobuch) wrote :

I checked in DraftSight, BabaCad, FreeCad, but in others it must be the same...

For simplicity, I drew only one line with a length of 10mm and I made a comparison of the generated files for the same version of kicad as before.
The only differences is the coordinates of the beginning and end of the line.

Revision history for this message
Seth Hillbrand (sethh) wrote :

I just checked with AutoCAD 2020 and the current file is the correct one. The previous file is not. It looks like the dxf import routine in the applications you listed is assuming mm rather than accepting the MEASUREMENT directive.

I'll leave this as a wishlist item to include the option to scale for mm as well

Changed in kicad:
importance: High → Wishlist
milestone: 5.1.3 → none
status: Incomplete → Triaged
Revision history for this message
Grzegorz Obuch (grzegorzobuch) wrote :

Thanks for that.

I think that a lot of applications do not accept the MEASUREMENT directive.

For me the reason why it has been changed on inch is just as bad as leaving mm for those applications that I use.

I did not notice this change and sent a file to do the smd stencil. It ended only with the re-sending of the file generated from the stable version of the kicad (I did not know then what was going on). My mistake, but many users can do the same.
I think for this reason the change on inch should be as Wishlist instead of change on mm ...

Revision history for this message
Grzegorz Obuch (grzegorzobuch) wrote :

PS.
KiCad importing dxf do not accept the MEASUREMENT directive too.

Revision history for this message
Seth Hillbrand (sethh) wrote :

You are right, since there is such wide variance, I'll push up the importance and make sure we take care of it shortly.

Changed in kicad:
milestone: none → 6.0.0-rc1
importance: Wishlist → Low
milestone: 6.0.0-rc1 → 5.1.3
Revision history for this message
Ian McInerney (imcinerney) wrote :

@Seth, do you want to do this or can I take a crack at it?

Revision history for this message
Seth Hillbrand (sethh) wrote :

All yours!

Changed in kicad:
assignee: Seth Hillbrand (sethh) → Ian McInerney (imcinerney)
Changed in kicad:
status: Triaged → In Progress
Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

Fixed in revision d5f680ecd23a8d70face0c120c2d7e001b6452e8
https://git.launchpad.net/kicad/patch/?id=d5f680ecd23a8d70face0c120c2d7e001b6452e8

Changed in kicad:
status: In Progress → Fix Committed
tags: added: pcbnew
Changed in kicad:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.