El borrador DXF es un módulo de software utilizado por el Std Abrir,
Std Importar y
Std Exportar para manejar el formato de archivo DXF.
From the user's point of view, the DXF import/export module will be loaded automatically when any of those commands are invoked and the file to open, import or export is a DXF file. The main difference between Std Open and the import command is that the former will create a new FreeCAD document and then do the import, whereas the later will import the DXF file and insert the result in the currently active document.
Dibujo Qcad exportado a DXF, que posteriormente se abre en FreeCAD
Two importers are available, which one is used can be specified under Edit → Preferences... → Import-Export → DXF. One is built-in, C++-based and fast, the other is legacy, coded in Python, slower, and requires the installation of an add-on, but can handle some entities better and can create more refined FreeCAD objects. Both support all DXF versions starting from R12.
Los objetos 3D dentro de un archivo DXF se almacenan bajo un blob binario ACIS/SAT, que por el momento no puede ser leído por FreeCAD. Sin embargo, entidades más sencillas como los 3DFACEs son soportados.
Entity | C++ importer | Legacy importer |
---|---|---|
Lines | ✓ | ✓ |
Polylines (and LWPOLYLINES) | ✓ | ✓ |
Arcs | ✓ | ✓ |
Circles | ✓ | ✓ |
Ellipses | ✓ | ✓ |
Splines | ✓ | ✓ |
Texts & MTexts | ✓ | ✓ |
Leaders | ✗ | ✓ |
Layers | ✓ | ✓ |
Points | ✓ | ✓ |
Dimensions | ✓ | ✓ |
Blocks | ✓ (Geometry only; texts, dimensions, and attributes inside blocks are skipped) |
✓ |
Paper space objects | ✓ | ✓ |
3D Faces | ✗ | ✓ |
Los archivos se exportan en el formato DXF R14, que puede ser manejado por muchas aplicaciones.
Feature | C++ exporter (R14) | Legacy exporter (R12) |
---|---|---|
Supported 2D Geometry | All except Bezier curves. Ellipses and Splines are exported natively. | All except Points. Ellipses and B-splines may be inaccurate or exported as polylines. |
Points | ✓ (If the "Export points" preference is enabled) |
✗ |
3D Objects | Edges from faces are exported. Curved edges only if on XY plane. May create duplicate lines. | Exported as flattened 2D views. |
Texts and Dimensions | ✗ | ✓ |
Colors | ✗ | ✓ (Based on object line color) |
Layers | ✓ (Mapped from object names) |
✓ (Mapped from layers and nested groups) |
Compounds | ✗ | ✓ (Exported as blocks) |
Por razones de licencia, las librerías de importación/exportación DXF necesarias para la versión antigua del importador no forman parte del código fuente de FreeCAD. Para más información ver: Importación FreeCAD y DXF.
Para más información, consulte: Preferencias de exportación.
Because the DWG format is a proprietary, closed and undocumented format it is hard for open-source projects like FreeCAD to support it. That is why FreeCAD relies on external converters to read and write DWG files. To import a DWG file a converter is used to create a DXF first, which can then be processed by the FreeCAD DXF importer. When exporting to DWG the opposite conversion happens: the DXF created by the FreeCAD DXF exporter is turned into a DWG.
Note that the DXF format allows a 1:1 conversion of the DWG format. All applications that can read and write DWG files can do the same with DXF files, with no data loss. So asking for DXF files instead of DWG files, and supplying DXF files in turn, should not cause any problems.
There is built-in support for the following DWG converters:
See Import Export Preferences and FreeCAD and DWG Import for more information.
See also: Autogenerated API documentation and FreeCAD Scripting Basics.
To export objects to DXF use the export
method of the importDXF module.
importDXF.export(objectslist, filename, nospline=False, lwPoly=False)
filename
.Ejemplo:
import FreeCAD as App
import Draft
import importDXF
doc = App.newDocument()
polygon1 = Draft.make_polygon(3, radius=500)
polygon2 = Draft.make_polygon(5, radius=1500)
doc.recompute()
objects = [polygon1, polygon2]
importDXF.export(objects, "/home/user/Pictures/myfile.dxf")