Skip to content

Project: Improve DXF import and export

Torsten Paul edited this page Jan 12, 2015 · 11 revisions

Outline

Currently OpenSCAD uses it's own limited parser to read DXF files (2D-only) which does not support things like curves/splines. Using an external library should provide better support for both import and export of DXF files.

Details

The main focus for the change is the import of DXF files as the import currently fails to read various categories of DXF files exported by other tools. Right now a complex preparation is needed to ensure drawings created in programs like Inkscape can be imported correctly in OpenSCAD. Using an existing external library with complete DXF support should make the process much easier.

Importing more complex drawings will need some integration with OpenSCAD features, e.g. the handling of $fn/$fa/$fs variables that define how curves are converted into the internal polygon/mesh data structures.

As the libraries normally support both reading and writing of DXF files, the export could be changed to use the selected library too. This is not highly critical as the export is based on a known set of internal data structures but would help to unify the code base. In case the library supports 3D DXF files, it would be nice to add support for that.

Topics that need to be solved

  • Research options of usable libraries
  • Investigate support for 2D and 3D import/export
  • Select library and integrate into OpenSCAD
  • Add test cases to verify the new export/import functionality
  • Update build system to include the new library into installers

Expected Outcome

  • OpenSCAD supports reading of 2D DXF files exported by other programs (e.g. Inkscape) without special preparation before the export (e.g. convert curves to straight lines)
  • Optional: Support for reading and writing 3D DXF

Project Properties

Skills

  • Programming language is C++
  • Understand and use APIs from external libraries
  • Integrate new libraries into the build system for the 3 supported platforms
  • Add test cases with files using the new features to allow regression testing

Difficulty

Easy

Additional Information

Known libraries:

Clone this wiki locally