I have a small DXF file (attached) that I have edited down in Librecad that loads correctly using the "legacy python importer" that I was able to select using a checkbox in a dialog box found here:
Code: Select all
Drafts workbench, Menu: Edit -> Preferences, Import-Export, DXF: [ ] Use legacy python importer
This is nearly the latest version, which I built from source last week.
I've had a look at the history of the two versions where it seems they are both under development:
https://github.com/FreeCAD/FreeCAD/comm ... portDXF.py
https://github.com/FreeCAD/FreeCAD/comm ... ExpDxf.cpp
This looks like unnecessary duplication of work, even though there is a presumption that C++ one is more up to date.
Personally, I don't think C++ is the right language to implement any import/export file features. It's really bad at handling the parsing of strings and there's very little speed advantage because the converter is not the bottleneck. If there is a bottleneck, it's because of a single linear file, or the callbacks to the main system where the internal entities are allocated and constructed.
It is in the nature of import/exporters to be generally buggy. The data is not simple and well-defined, and is often written and read by other buggy programs. A C++ implementation creates a much higher barrier to getting these superficial but serious bugs fixed than a Python implementation -- where you can debug make minor modifications and quickly try them out in real time in the middle of a job.
I searched and I cannot find any discussions about this sort of thing anywhere. It would be good to know what people are thinking about this when they are doing their development.
DXF parsing has a lot of use outside of FC, so it would be even more productive to use an outside library that's going to get much better maintained, because it's done in isolation. When I was working with DXF parsers last year I had a lot of joy with https://github.com/mozman/dxfgrabber
Now I've looked, it seems that the author of that package has superseded it with https://github.com/mozman/ezdxf which is under active development and can both read and write DXFs. What about basing all the DXF conversions his lovely-looking library?