Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There should be a single DXF importer/exporter #13599

Open
2 tasks done
FEA-eng opened this issue Apr 23, 2024 · 8 comments
Open
2 tasks done

There should be a single DXF importer/exporter #13599

FEA-eng opened this issue Apr 23, 2024 · 8 comments
Labels
Core Issue or PR touches core sections (App, Gui, Base) of FreeCAD Feature FR for improvements or new features File format: DXF

Comments

@FEA-eng
Copy link
Contributor

FEA-eng commented Apr 23, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Problem description

DXF import/export is a hot topic. There have been many issues with it and it seems that there are still some problems left. Apparently, the legacy importer/exporter should be used in most cases. But ideally, there should be only a single importer/exporter (with all the benefits and features of the current two implementations) or at least the better/recommended one should be the default to avoid the confusion. Are there any plans for that? I guess that it won't happen before the next release but it's something that should be resolved as soon as possible, in my opinion.

Full version info

OS: Windows 10 build 19045
Word size of FreeCAD: 64-bit
Version: 0.22.0dev.36958 (Git)
Build type: Release
Branch: main
Hash: a041129090b8dcbb8367636840d3c668ef30a933
Python 3.11.9, Qt 5.15.13, Coin 4.0.2, Vtk 9.2.6, OCC 7.7.2
Locale: Polish/Poland (pl_PL)

Subproject(s) affected?

Core

Anything else?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@yorikvanhavre
Copy link
Member

Ideally the newer, built-in C++ dxf importer should be used but it still does not support all the features of the old one... Not sure how fast this can be done, it basically needs volunteers to work on it :)

@maxwxyz maxwxyz added Core Issue or PR touches core sections (App, Gui, Base) of FreeCAD Feature FR for improvements or new features File format: DXF labels Apr 23, 2024
@FEA-eng
Copy link
Contributor Author

FEA-eng commented Apr 23, 2024

Ideally the newer, built-in C++ dxf importer should be used but it still does not support all the features of the old one... Not sure how fast this can be done, it basically needs volunteers to work on it :)

Thanks for the reply. Sure, there's no hurry but I just wanted to document this for the future and ask if it's already planned.

Maybe a potential GSoC candidate?

@furgo16
Copy link
Contributor

furgo16 commented Apr 23, 2024

it still does not support all the features of the old one

Is there a list of missing features, or a side by side comparison of the two existing importers/exporters? If there isn't, how how could a community member best start compiling such a list?

For context, I could not even find the source code for the legacy importer's DXF library (I understand there are license compatibitibility issues and that's why it's not distributed, but I don't quite understand where the actual code resides). I did find some interesting information here though: https://forum.freecad.org/viewtopic.php?style=1&p=2448#p2448

Edit: found the source code at https://github.com/yorikvanhavre/Draft-dxf-importer

@Syres916
Copy link
Contributor

Purely from a personal point of view, my defacto goto solution to get a dxf file into FreeCAD is https://pypi.org/project/ezdxf/ it's extremely well maintained in my experience, handles layers well and I just run a macro to convert all the objects to sketches.

@furgo16
Copy link
Contributor

furgo16 commented Apr 23, 2024

I just run a macro to convert all the objects to sketches.

Out of interest, which macro do you use to talk to ezdxf? I've noticed a similar approach at https://forum.freecad.org/viewtopic.php?t=81962, but I've not tried it.

@Syres916
Copy link
Contributor

I use https://github.com/FreeCAD/FreeCAD-macros/blob/master/Conversion/DxfToSketchLayers.FCMacro but I've not tested it on recent 0.22dev so it might need modifying. Ignore the installation part of the code, just install ezdxf using pip before running the macro.

@yorikvanhavre
Copy link
Member

It depends a lot on your given workflow too... DXF files are used for sometimes very different purposes. In the construction field, DXF files with thousands of small objects are not a rarity, while for people working with CNC a DXF file is often one single, precise profile shape. So for some users it's important that files import as a clean sketch, for others that would be counter-productive

@furgo16
Copy link
Contributor

furgo16 commented Apr 26, 2024

Is there a list of missing features, or a side by side comparison of the two existing importers/exporters? If there isn't, how how could a community member best start compiling such a list?

I think I can answer my own question now, as I did that side by side comparison.

It is not exhaustive and only includes those features in the preferences dialog (e.g. it does not contemplate DXF entities support, etc.). It might need another pair of eyes to confirm that I read the code correctly, but I hope it provides an overview of the current status:

Capability Python importer C++ importer Notes
Import texts and dimensions
Import points
Import layouts
Import *blocks
Create simple Part shapes
Create Draft objects C++: works partially, for annotations only. Other Draft objects (line, circle, etc) are not created, Part shapes are created instead. Needs further analysis to confirm.
Create Sketches
Apply scale factor to import C++: #13600
Use colors from the DXF file
Join geometry Python: can join sketches or shapes
Group layers into blocks C++: #13597
Use standard font size for texts
Use layers C++: #13597
Import hatch boundaries as wires
Render polylines with width C++: #6112

From:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core Issue or PR touches core sections (App, Gui, Base) of FreeCAD Feature FR for improvements or new features File format: DXF
Projects
None yet
Development

No branches or pull requests

5 participants