Workaround for DXF import line width bug

Hi, when I import my DXF file into F.Silk layer it appears that the line width setting in the import dialog is ignored and the line width is extremely thin.

According to what I’ve read this is a bug .

Ok, so how can I workaround this bug, how can I set the line width after importing the DXF file?

I am unable to select individual line segments by clicking and anyway there are many many of those.

I can drag select them but then I cannot ‘E’ edit the properties.

Below is my version info.

Application: Pcbnew
Version: (5.1.6-0), release build
Libraries:
wxWidgets 3.0.4
libcurl/7.54.0 LibreSSL/2.0.20 zlib/1.2.11 nghttp2/1.24.0
Platform: macOS High Sierra Version 10.13.6 (Build 17G6030), 64 bit, Little endian, wxMac
Build Info:
wxWidgets: 3.0.4 (wchar_t,STL containers,compatible with 2.8)
Boost: 1.72.0
OpenCASCADE Community Edition: 6.9.1
Curl: 7.54.0
Compiler: Clang 9.0.0 with C++ ABI 1002

Build settings:
USE_WX_GRAPHICS_CONTEXT=ON
USE_WX_OVERLAY=ON
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

This is the file I try to import.

In KiCAD the lines are so thin that they do now showup in 3D view…

eazycnclogo.dxf (30.6 KB)

What is the size of your logo supposed to be?
I imported it a few times, and when imported with a scale of 1:1 it is 430mm wide.
In the screenshot below the paper size is A4.

As you can see, I can import with different line widths, but it seems to be truncated to whole millimeters.

I also imported it twice at a scale of 0.1
The fat lines are imported as 200.4 mm width, which results in 2mm on the PCB. So there is something fishy going on here.

After that I opened the .kicad_pcb file in a text editor and did a search and replace operation:
image

And it seems to work. The line width was changed to 1.232mm after a save and open in KiCad. By also searching for the parentheses and layer name, you get less false positives with the search.

I can also import it in the Footprint editor with:
Footprint Editor / File / Import Outlines from DXF File
Even though it says “outline” in the menu, I can still import on F.SilkS.

It has the same line width problem though.

Currently the best workaround to me looks like:

  1. Make a new KiCad project.
  2. Create a new Footprint Library in this project.
  3. Make a new footprint with your logo in this project.
  4. Change line widths with a text editor.
  5. Use your modified footprint in a normal project.

An alternative route would be to work with FreeCAD and the KicadStepUp workbench, but that has a learning curve of it’s own.

It looks like there are 2 overlapping bugs. One is the truncation to whole millimeters, and the other is that line widths are scaled diferently when importing scaled DXF files. So a part of a workaround is to export your image in the right size from your other CAD program.

Do you have a link to the info you found about this bug?
Has this been reported on gitlab?

My KiCad version is:

Application: KiCad
Version: 5.1.7-a382d34a8~87~ubuntu20.04.1, release build
Libraries:
wxWidgets 3.0.4
libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3
Platform: Linux 5.4.0-51-generic x86_64, 64 bit, Little endian, wxGTK
Build Info:
wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 3.24
Boost: 1.71.0
OpenCASCADE Community Edition: 6.9.1
Curl: 7.68.0
Compiler: GCC 9.3.0 with C++ ABI 1013

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

1 Like

Thanks for testing and suggestions for workaround, I will try the foot print text edit route. The logo is supposed to be 22 mm, at least that what my drawing programs shows.

The bug I found is this one:

I played with this and think Nothing is wrong - no Bug, it seems to work as ‘I’ (a user) thinks it should work. AFTER setting the Preference’s… At least on my machine (Mac, OSX, Kicad 5.1.7).

The default setting for Canvas Size is the ‘Key’ to success…

I set it as shown below (1.0mm, Not Automatic) then, imported a test DXF I made; Before clicking ok, I set the Line Width to 1.2mm and, Bingo! It imported as 1.2xx (extra digits due to Snap setting but, you get the point. Change the Pref’s!

Results:

Thanks for testing and that workaround. As ‘user’ I would never think that something like ‘user interface / canvas scale’ would affect DXF import, especially since the DXF import dialog has a line width setting, and more over in the footprint editor the line width setting in the dialog does do something.

I un-checked the automatic for canvas scaling (It was already at 1.0) and imported lines at 1.814mm and after import linewidth was 1.000mm according to KiCad.

Nope, I don’t get your point. Why would a “snap setting” have anything to do with linewidth?

The width of the lines during import is a part of the CAD data and not GUI
representation, and it should be accurate to KiCad’s internal resolution, which is (I think) 1um. (Or is it a nanometer?) But it should not change from 1.2mm to 1.216mm

I can speak only for my experience:

The Snapping refers to the Measure Tool’s measuring the Line Width. Actual = 1.200, MeasureTool snapped to Grid shows 1.216. I didn’t fuss with dialing it in to exactness.

It wouldn’t but, it does on my system - very repeatable. Why? IMO because it’s OpenSource software… Actaually, not sure what you mean by “Snap Setting” - I didn’t set anything related to snap setting, only set the Grid.

Ahh… perhaps you’re thinking the Panels line-width should show the line’s width as created.? No, it’s a number you enter or use the one that’s there.
I entered the 1.2 before clicking OK. And, measure it in PCBnew with the Measure Tool.

Ah, now I understand your “snap” thing. When you place measurements on the schematic, it uses snap. But that is not what I did.

I pressed “e” and looked at the properties of the line width itself, which gives real numbers.

Cool - I was making a vid and finished it before reading your last post. Posting vid anyway…

I used a different approach:

I imported your dxf file with the following parameters on an empty layer (eg. Eco2.User):
image

your logo now logo now looks like this (I checked the line thickness clicking on a line and then hitting ‘e’)

then I modifiy the properties of the drawing on “Edit->Edit text and graphic properties”:

Now your logo looks like this:

I did not make any modification on my PCBNew settings, nor have I done it before, for me this are the stock settings:

Application: Pcbnew
Version: (5.1.7)-1, release build
Libraries:
    wxWidgets 3.0.5
    libcurl/7.71.0 OpenSSL/1.1.1g (Schannel) zlib/1.2.11 brotli/1.0.7 libidn2/2.3.0 libpsl/0.21.0 (+libidn2/2.3.0) libssh2/1.9.0 nghttp2/1.41.0
Platform: Windows 8 (build 9200), 64-bit edition, 64 bit, Little endian, wxMSW
Build Info:
    wxWidgets: 3.0.5 (wchar_t,wx containers,compatible with 2.8)
    Boost: 1.73.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.71.0
    Compiler: GCC 10.2.0 with C++ ABI 1014

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

EDIT: I just noticed that I did modify the settings to set another text editor, but that was it :slight_smile:

I can confirm that line width can be changed with:
Pcbnew / Edit / Edit Text and Graphic Properties

And then with settings:
Scope: [x] PCB graphic items

and:
Action: Line Thickness …

In my test I did the initial import on the F.SilkS layer.
So there is no need to hack into files with a text editor.

Still there seem to be 2 bugs in the linewidth during import:
Linewidth seems to be truncated first to a whole number of mm.
Linewidth seems to be scaled with the square of the “Import Scale” factor. In der.ule’s example a scale factor of 0.01 resulted in a line widht of 0.0001.

I don’t see the first issue in my version, using this funky line thickness:

image

I get:

as you can see, I am using “.” as a decimal separator and not “,” and the language is set to English. Maybe that old issue ?

Thanks everyone for your digging into this problem.
I can still experience the first problem I reported, but I’ve now solve immediate issue via the footprint / text editor hack as suggested paulvdh. So I’m good, thanks!

Looks to me that the later idea of importing to an empty layer like Ec02.User and using the Edit text and graphic properties would be even easier but have not tried this as, like I said, I’m good.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.