DXF

From FreeCAD Documentation
Revision as of 15:10, 7 May 2019 by Renatorivo (talk | contribs) (Created page with "La storia di DXF è quasi identica al formato di file DOC di Microsoft Word: c'erano molte versioni incompatibili prodotte durante l'evoluzione del prodotto e tutti gli altri...")

Storia

DXF è un formato di dati CAD proprietario per disegni 2D originato con AutoCAD, ma che è compreso dalla maggior parte dei pacchetti di disegno e di plotting, poiché non era disponibile uno standard aperto alternativo durante gli anni in cui AutoCAD era dominante.

La storia di DXF è quasi identica al formato di file DOC di Microsoft Word: c'erano molte versioni incompatibili prodotte durante l'evoluzione del prodotto e tutti gli altri programmi di elaborazione testi dovevano in una certa misura leggere e scrivere questi file per sopravvivere. Spesso queste implementazioni sono incomplete, obsolete e opinabili.

The same is true for DXF. You will hear of certain key versions of DXF, such as R12 (from 1992) or R14 (from 1997 which had splines). Later versions of DXF had 3D elements, but these are rarely used or implemented. How you use DXF to share CAD data between two programs depends mainly on the limitations and bugs in the corresponding readers/importers and writers/exporters. Not surprisingly, there is rarely complete documentation of program limitations and bugs, which is a great source of frustration.

If you are editing DXF files and expecting them to remain almost the same when you save them, we recommend you use LibreCAD or QCad because these programs' internal data structures are compatible with the objects in the DXF file.

In FreeCAD the DXF readers must interpret the geometry (eg a spline shapes) from the DXF file into the specific internal forms of the Workbench.

Methods for importing DXF to FreeCAD

If you intend to review the settings frequently, we recommend you go to Edit → Preferences → Import-Export → DXF and tick the box "[ ] Show this dialog when importing and exporting".

More information is on the pages Draft DXF and FreeCAD and DXF Import.

If you are using the imported geometry to build 3D shapes in the Part Design Workbench, try the Sketcher Validate after you have imported the DXF into a sketch.

C++ DXF importer

This implementation of fast, but skips features it doesn't recognize, such as DXF splines. It also can only import geometry into the Draft Workbench as individual entries in the Model tree. These can have the colors read from the file if you tick to enable this option. For further information, see this forum post.

Python DXF importer

This importer has to be downloaded and installed before it can be used. See Dxf Importer Install, or use the "[ ] Allow FreeCAD to automatically download and update the DXF libraries" option.

This importer has more features (such as implementing splines), and has the option of loading the DXF shapes into the Sketcher. However, be warned that all the elements of the sketch will appear individually a second time in the model tree, which can be confusing. You can delete all these individual objects and retain the single sketch (which appears as the second entry in the list of new elements).

Unfortunately, the Sketch Workbench does not implement colors, so all the geometry will appear on the same level, which is a problem if the file contains many construction lines. One work-around is to open your drawing in LibreCAD, and delete all the geometry you don't want to appear before saving a file that contains exactly the geometry that you want to load.

Macros

Keep an eye out on the FreeCAD forum or in the Macros_recipes for alternative implementations of DXF importing and cleaning up as they develop.


Saving DXF

In addition to the options under the Edit → Preferences, the TechDraw Workbench can also export drawing pages to DXF using the TechDraw SaveDXF function.