Borrador DXF
Descripción
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
Importación
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 | ✗ | ✓ |
Exportación
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) |
Instalación
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.
Preferencias
Para más información, consulte: Preferencias de exportación.
DWG
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:
- LibreDWG (open-source, lacks support for some DWG entities).
- ODA File Converter (free).
- QCAD pro (commercial).
See Import Export Preferences and FreeCAD and DWG Import for more information.
Scripting
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)
- For the Windows OS: use a / (forward slash) as the path separator in
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")
- Drafting: Line, Polyline, Fillet, Arc, Arc From 3 Points, Circle, Ellipse, Rectangle, Polygon, B-Spline, Cubic Bézier Curve, Bézier Curve, Point, Facebinder, ShapeString, Hatch
- Annotation: Text, Dimension, Label, Annotation Styles, Annotation Scale
- Modification: Move, Rotate, Scale, Mirror, Offset, Trimex, Stretch, Clone, Array, Polar Array, Circular Array, Path Array, Path Link Array, Point Array, Point Link Array, Edit, Highlight Subelements, Join, Split, Upgrade, Downgrade, Convert Wire/B-Spline, Draft to Sketch, Set Slope, Flip Dimension, Shape 2D View
- Draft Tray: Working Plane, Set Style, Toggle Construction Mode, AutoGroup
- Snapping: Snap Lock, Snap Endpoint, Snap Midpoint, Snap Center, Snap Angle, Snap Intersection, Snap Perpendicular, Snap Extension, Snap Parallel, Snap Special, Snap Near, Snap Ortho, Snap Grid, Snap Working Plane, Snap Dimensions, Toggle Grid
- Miscellaneous: Apply Current Style, New Layer, Manage Layers, New Named Group, SelectGroup, Add to Layer, Add to Group, Add to Construction Group, Toggle Wireframe, Working Plane Proxy, Heal, Show Snap Toolbar
- Additional: Constraining, Pattern, Preferences, Import Export Preferences, DXF/DWG, SVG, OCA, DAT
- Context menu:
- Most objects: Edit
- Layer container: Add New Layer, Reassign Properties of All Layers, Merge Layer Duplicates
- Layer: Activate Layer, Reassign Properties of Layer, Select Layer Contents
- Text and label: Open Links
- Wire: Flatten
- Working plane proxy: Save Camera Position, Save Visibility of Objects
- Getting started
- Installation: Download, Windows, Linux, Mac, Additional components, Docker, AppImage, Ubuntu Snap
- Basics: About FreeCAD, Interface, Mouse navigation, Selection methods, Object name, Preferences, Workbenches, Document structure, Properties, Help FreeCAD, Donate
- Help: Tutorials, Video tutorials
- Workbenches: Std Base, Assembly, BIM, CAM, Draft, FEM, Inspection, Material, Mesh, OpenSCAD, Part, PartDesign, Points, Reverse Engineering, Robot, Sketcher, Spreadsheet, Surface, TechDraw, Test Framework
- Hubs: User hub, Power users hub, Developer hub
