Import DXF silently fails on file version newer than it supports

Bug #1667317 reported by Alessandro Fabilli
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KiCad
Fix Committed
High
jean-pierre charras

Bug Description

I use this nightly build:

Application: kicad
Version: (2017-02-22 revision d1a2ed63c)-makepkg, release build
Libraries: wxWidgets 3.0.2
           libcurl/7.52.1 OpenSSL/1.0.2k zlib/1.2.11 libssh2/1.8.0 nghttp2/1.19.0 librtmp/2.3
Platform: Windows 8 (build 9200), 64-bit edition, 64 bit, Little endian, wxMSW
- Build Info -
wxWidgets: 3.0.2 (wchar_t,wx containers,compatible with 2.8)
Boost: 1.60.0
Curl: 7.52.1
KiCad - Compiler: GCC 6.3.0 with C++ ABI 1010
        Settings: USE_WX_GRAPHICS_CONTEXT=OFF
                  USE_WX_OVERLAY=OFF
                  KICAD_SCRIPTING=ON
                  KICAD_SCRIPTING_MODULES=ON
                  KICAD_SCRIPTING_WXPYTHON=ON
                  KICAD_SCRIPTING_ACTION_MENU=OFF
                  BUILD_GITHUB_PLUGIN=ON
                  KICAD_USE_OCE=ON

When I use in Pcbnew the command "File-> import-> File DXF" the result is nothing. The file is not imported.
The file is created with Corel version X7. I tested to create a file DXF with Autocad but the result in the same. The file is not loaded.

I attached two file: the file_old.dxf is imported in Kicad (created with old versione of Corel, i not remember version), the file_new.dxf in not imported (created with Corel X7 or Autocad LT2014)

Tags: dxf import pcbnew
Revision history for this message
Alessandro Fabilli (o-alessandro) wrote :
Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

Most likely the new dxf file is saved in a file version that kicad does not support. I opened you new dxf file without any issues on DraftSight 2017. Try saving your new dxf file as a version 14 dxf file using Corel. I believe only supports dxf versions 14 and below.

Revision history for this message
Alessandro Fabilli (o-alessandro) wrote :

I no longer have the Corel version 14 !!!
I tried to save the DXF file with Autocad, but also does not work. If you can tell me in what format to save the DXF file can do the tests.

Revision history for this message
Wayne Stambaugh (stambaughw) wrote : Re: [Bug 1667317] Re: Import DXF

I did mean Corel 14. I meant DXF version 14. That being said, I
converted your file_new.dxf to dxf version 14 and I still could not
import it so there is something amiss with the dxf importer. Even if
there is something in your file that the dxf importer is choking on it
should still give you and error rather than just silently do nothing.

On 2/27/2017 4:02 AM, Alessandro Fabilli wrote:
> I no longer have the Corel version 14 !!!
> I tried to save the DXF file with Autocad, but also does not work. If you can tell me in what format to save the DXF file can do the tests.
>

Changed in kicad:
status: New → Confirmed
Revision history for this message
Alessandro Fabilli (o-alessandro) wrote : Re: Import DXF

Sorry I did not understand.

I do not understand what you mean with version 14. From Corel X7 I can export to DXF for AutoCAD R14 version. I tried but it does not work.
Instead of exporting it I tried to save it in DXF (also version Autocad 2000), but does not work.
I tried to do even with Autocad DXF files (I have the version LT 2014) but does not work.
I'm available to do other tests to help.
Sorry for the English but is not the best

Revision history for this message
Wayne Stambaugh (stambaughw) wrote : Re: [Bug 1667317] Re: Import DXF

The dxf file format has changed many times over the years resulting in
different file format versions. DXF file format version 14 is the
latest version that KiCad supports if you DXF file is saved as a DXF
version later that 14, KiCad will not be able to import it.

On 2/27/2017 9:07 AM, Alessandro Fabilli wrote:
> Sorry I did not understand.
>
> I do not understand what you mean with version 14. From Corel X7 I can export to DXF for AutoCAD R14 version. I tried but it does not work.
> Instead of exporting it I tried to save it in DXF (also version Autocad 2000), but does not work.
> I tried to do even with Autocad DXF files (I have the version LT 2014) but does not work.
> I'm available to do other tests to help.
> Sorry for the English but is not the best
>

Revision history for this message
Alessandro Fabilli (o-alessandro) wrote : Re: Import DXF

So there is no solution?
Or you are working to solve the problem?

Revision history for this message
Alessandro Fabilli (o-alessandro) wrote :

Excuse me, but why not implement the import of bitmap?

Revision history for this message
Wayne Stambaugh (stambaughw) wrote : Re: [Bug 1667317] Re: Import DXF

It will be a long while before I will have any time to look at it.
Maybe someone else who is more familiar with the dxf import code can
look at it before I get a chance.

On 2/27/2017 9:48 AM, Alessandro Fabilli wrote:
> So there is no solution?
> Or you are working to solve the problem?
>

Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

Use the bitmap2component too convert bitmaps to schematic or board
objects to import into your schematics and boards.

On 2/27/2017 9:59 AM, Alessandro Fabilli wrote:
> Excuse me, but why not implement the import of bitmap?
>

Revision history for this message
Alessandro Fabilli (o-alessandro) wrote : Re: Import DXF

Ok. At the moment I try with bitmap2component. For import logo is possible, for import Mecanichal design this is not the maximun

Revision history for this message
Alessandro Fabilli (o-alessandro) wrote :

I test bitmap2component but result is not good. At moment I prefer to used old logo.

Revision history for this message
Alessandro Fabilli (o-alessandro) wrote :

News.
I did more tests and I arrived at a solution: I exported the DXF files from AutoCAD LT2014 to the format for Autocad R12 / LT12. This format is imported from Kicad smoothly. I attach the file.

When I did the tests with bitmap2component I found a bug: the RoundButton "Negativo" and "Normale" mode to save your image is inverted select !!!
"Negativo" Save as normal and "Normale" save as negative.
Sorry but I use the program in italian and when I change language not have effect in bitmap2component, another bug?

Revision history for this message
Wayne Stambaugh (stambaughw) wrote : Re: [Bug 1667317] Re: Import DXF

This is what I expected. Saving to an older file format resolved the
issue which would indicate that the kicad dxf code failed to parse the
newer file format. That being said, our dxf imported should not have
silently failed. It should have displayed some kind of error message.
Please leave this bug report open so we can at least fix that part.

On 3/2/2017 6:32 AM, Alessandro Fabilli wrote:
> News.
> I did more tests and I arrived at a solution: I exported the DXF files from AutoCAD LT2014 to the format for Autocad R12 / LT12. This format is imported from Kicad smoothly. I attach the file.
>
> When I did the tests with bitmap2component I found a bug: the RoundButton "Negativo" and "Normale" mode to save your image is inverted select !!!
> "Negativo" Save as normal and "Normale" save as negative.
> Sorry but I use the program in italian and when I change language not have effect in bitmap2component, another bug?
>
>
> ** Attachment added: "R12LT2.dxf"
> https://bugs.launchpad.net/kicad/+bug/1667317/+attachment/4829728/+files/R12LT2.dxf
>

Jeff Young (jeyjey)
summary: - Import DXF
+ Import DXF silently fails on file version newer than it supports
Jeff Young (jeyjey)
Changed in kicad:
importance: Undecided → Medium
tags: added: dxf import pcbnew
Seth Hillbrand (sethh)
Changed in kicad:
assignee: nobody → Seth Hillbrand (sethh)
status: Confirmed → In Progress
Revision history for this message
Seth Hillbrand (sethh) wrote :

The silent aspect of this bug report will need to wait until we are out of string freeze.

While we do support both versions, we silently ignore splines from the DXF14.

Changed in kicad:
milestone: none → 6.0.0-rc1
Jeff Young (jeyjey)
Changed in kicad:
importance: Medium → High
Revision history for this message
jean-pierre charras (jp-charras) wrote :

Please, do not change anything to the DXF import and the S_CURVE support.

In my working tree, I switched to an other dxf library, added support or splines and fixed broken and missing code in Pcbnew for Bezier curves.

There is no change in file format (Bezier curves are already supported) so it can be committed in 5.1 version (as it is more a bug fix than a new feature).

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

Ok will do.

However, my impression from the scurve implementation in the code was that it is still a work in progress. Do you have plans for adding them as a full element?

Revision history for this message
jean-pierre charras (jp-charras) wrote :

Many of S_CURVE implementation was already in code.
Some missing code was missing (Hit test, BBox calculation, point edition, move and rotation transforms)), but it was not a complicated code.
I also fixed bugs and optimized some calculations (in drawings)

The only missing code in my work is the creation of a Bezier curve (S_CURVE in code) in Pcbnew.
For me, the main interest of Bezier curve support is the import of these curves from Eagle and import of splines from dxf files (Splines are converted to Bezier curves during import).

Now the master branch is open to commits, I can commit my work.

Seth Hillbrand (sethh)
Changed in kicad:
assignee: Seth Hillbrand (sethh) → jean-pierre charras (jp-charras)
status: In Progress → Fix Committed
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.