FreeCAD / FreeCAD/FreeCAD

[FR] DXF importer: Implement 'Polyline width' feature (was: DXF files open with wrong line thickness. Resaving lost thickness information)

Open
#6,112 9 comments 0 reactions 0 assignees View on GitHub
File format: DXF File formats Mod: Core Type: Feature Type: Has workaround
Dominant language
C++
Stars
33.6k
Forks
6k
Avg merge
3d 17h
Merged PRs (30d)
196

Description

Issue imported from https://tracker.freecad.org/view.php?id=4454

* **Reporter:** efa
* **Date submitted:** 10/9/2020
* **FreeCAD version:**
* **Category:** Feature
* **Status:** confirmed
* **Tags:** DXF

# Original report text

hi,
the line thickness when importing DXF is wrong.
The exported files become corrupt lost thickness information

# Additional information

the problem is present in LibreCAD and QCAD Community edition too, see:
https://sourceforge.net/p/librecad/bugs/520/

QCAD Pro and Autodesk TrueView open DXF correctly

# Steps to reproduce

Open a DXF file with line thinckness set, use the attached as test.
[PCBtracks_demo.zip](https://github.com/FreeCAD/FreeCAD/files/8773950/PCBtracks_demo.zip)

The line property "polyline width" is not rendered
Export as DXF
Open the exported DXF with QCAD pro, the line thinkness is wrong

![image](https://user-images.githubusercontent.com/4140247/170350163-afee6fe1-cb83-402c-917d-e543069e36ae.png)

# FreeCAD Info

```
OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22665 (Git)
Build type: Release
Branch: master
Hash: b0d7850406e046f3b7a8cd5da261e7d54df6bd99
Python version: 3.8.6
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.4.0
Locale: Italian/Italy (it_IT)

```

# Other bug information

* **Priority:** normal
* **Severity:** feature
* **Category:** Feature
* **Updated:** 9/7/2021

# Discussion from Mantis ticket

### Comment by openBrain 2020-10-09 21:09
efa : please address your issue according [our reporting guidelines](https://forum.freecadweb.org/viewtopic.php?f=3&t=5236) by opening a new topic on [our forum](https://forum.freecadweb.org/index.php). Thx

---

### Comment by efa 2020-10-10 19:59
https://forum.freecadweb.org/viewtopic.php?f=8&t=51003

---

### Comment by efa 2020-10-10 20:15
![image](https://user-images.githubusercontent.com/4140247/170350064-8c2a529e-1da1-4888-bb6e-616ced0a87aa.png)

---

### Comment by efa 2020-10-10 20:18
see how is rendered by FreeCAD last stable on Linux:

OS: LMDE 4 (debbie)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.
Build type: Release
Python version: 2.7.16rc1
Qt version: 5.11.3
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: Italian/Italy (it_IT)

same as 0.19 on Windows

---

### Comment by chennes 2021-02-07 06:02
I can confirm this in:
OS: Windows 10 Version 2004
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.23935 (Git)
Build type: Debug
Branch: master
Hash: d5b68febbb4989b290b9af36bb2cb21d61a87a2e
Python version: 3.8.6+
Qt version: 5.15.1
Coin version: 4.0.1
OCC version: 7.5.0
Locale: English/United States (en_US)

The width is simply being exported as the scale, rather than whatever the value of the width was supposed to be. If you use the FreeCAD option renderPolylineWidth in the DXF import preferences settings you can get FC to try to render the line with width, but this does not fix the export issue.

---

### Comment by efa 2021-02-07 15:34
on Linux, 0.19dev also with renderPolylineWidth in the DXF import active, I can't see right tickness:

OS: LMDE 4 (debbie) (MATE/mate)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.23756 (Git) AppImage
Build type: Release
Branch: master
Hash: 9c6e9184930a52b165a0b7274e3a45d1006bfe67
Python version: 3.8.6
Qt version: 5.12.5
Coin version: 4.0.0
OCC version: 7.4.0
Locale: Italian/Italy (it_IT)

---

### Comment by chennes 2021-08-26 15:10
FreeCAD's lines don't have the concept of individual width -- using the user preference option "Render Polylines with Width" will allow the conversion of the lines into rectangles internally so that this file displays more correctly. But note that this will change their representation in any DXF file that is then exported from FreeCAD. I've marked this as a "feature request" as in the long term, improved import and export of DXF files might be desirable.

---

### Comment by efa 2021-08-27 14:08
just upgraded from
FreeCAD_0.19-23756-Linux-Conda_glibc2.12-x86_64.AppImage
to
FreeCAD_0.19-24291-Linux-Conda_glibc2.12-x86_64.AppImage
I keep the Preference, Import/Export, DXF: Draw polyline width set
but I still get all lines at minimum width as in the PCBtracks_demo_FreeCAD.png
I cannot get rectangles

---

### Comment by chennes 2021-09-06 20:11
Are you using the legacy Python importer? I don't think the newer C++ importer supports the width parameter at all yet.

---

### Comment by efa 2021-09-06 20:28
I think it is the default one.
How can I check which importer is used?

---

### Comment by chennes 2021-09-07 14:02
Preferences->Import/Export->DXF->Use Python Legacy Importer (which is not the default, I don't think).

---

### Comment by efa 2021-09-07 17:35
it was selected "Usa il vecchio importatore python" that should be the Python Legacy Importer, I de-selected it, but the results is the same.
Attached the dialog box, is there something I had to set different?
![image](https://user-images.githubusercontent.com/4140247/170349938-fcb35ac2-5903-48fa-b871-576b5f4bc288.png)

---

### Comment by chennes 2021-09-07 21:15
You should have "Usa il vecchio importatore python" checked, but that's otherwise correct I think. When I select those options this is what I get:
![image](https://user-images.githubusercontent.com/4140247/170349893-0f07ce4b-8db2-4b0b-9749-0773cc452af3.png)

---

### Comment by efa 2021-09-07 21:38
OK, using the old python importer I get your output, and its lot better.
Probably in the past I had selected only old python exporter

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.