FreeCAD / FreeCAD

This is the official source code of FreeCAD, a free and opensource multiplatform 3D parametric modeler.
https://www.freecad.org
Other
21.36k stars 4.15k forks source link

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

Open FreeCAD-Bug-Importer opened 2 years ago

FreeCAD-Bug-Importer commented 2 years ago

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

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

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

image

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

Discussion from Mantis ticket

Comment by openBrain 2020-10-09 21:09

efa : please address your issue according our reporting guidelines by opening a new topic on our forum. 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


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


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


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

luzpaz commented 2 years ago

@yorikvanhavre ping (since we recently fixed #5793)

yorikvanhavre commented 2 years ago

Polyline width still needs to be implemented in the C++ DXF importer

luzpaz commented 2 years ago

@yorikvanhavre Should I rename this ticket to then to DXF importer: Implement 'Polyline width' feature ?

yorikvanhavre commented 2 years ago

yes, good idea!

luzpaz commented 1 year ago

@ageeye are you still working on this ?

ageeye commented 1 year ago

@luzpaz Unfortunately, I don't have time at the moment. When it's convenient again, I'll have a look.

yorikvanhavre commented 1 year ago

In any case it's a low priority item since it is already possible with the python importer.

luzpaz commented 1 year ago

@yorikvanhavre can you specify how (for posterity) ?

yorikvanhavre commented 1 year ago

Edit -> Preferences -> Import/Export -> DXF -> Render polylines with width