Draft DXF è un modulo software utilizzato dai comandi Apri,
Importa
ed Esporta per gestire il formato 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.
Disegno fatto con Qcad esportato in DXF, e successivamente aperto in FreeCAD
Sono disponibili due importatori, i quali possono essere specificati in Modifica → Preferenze... → Importa-Esporta → DXF. Uno è integrato, basato su C++ e veloce, l'altro è legacy, codificato in Python, più lento e richiede l'installazione di un componente aggiuntivo, ma può gestire meglio alcune entità e può creare oggetti FreeCAD più raffinati. Entrambi supportano tutte le versioni DXF a partire dalla R12.
I solidi 3D all'interno di un file DXF sono memorizzati in un blob binario ACIS/SAT, che al momento non può essere letto da FreeCAD.
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 | ✗ | ✓ |
Ci sono anche due esportatori. L'esportatore legacy esporta nel formato DXF R12, l'esportatore C++ nel formato DXF R14. Entrambi i formati possono essere gestiti da molte applicazioni.
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) |
Per motivi di licenza, le librerie di importazione/esportazione DXF richieste dalla versione legacy dell'importatore non fanno parte del codice sorgente di FreeCAD. Per ulteriori informazioni vedere: FreeCAD e Importazione DXF.
Vedere Preferenze di Importa/Esporta.
Poiché il formato DWG è un formato proprietario, chiuso e non documentato, è difficile per i progetti open source come FreeCAD supportarlo. Ecco perché FreeCAD si affida a convertitori esterni per leggere e scrivere file DWG. Per importare un file DWG viene utilizzato un convertitore per creare prima un DXF, che può poi essere elaborato dall'importatore DXF di FreeCAD. Quando si esporta in DWG avviene la conversione opposta: il DXF creato dall'esportatore DXF di FreeCAD viene trasformato in un DWG.
Tenere presente che il formato DXF consente una conversione 1:1 del formato DWG. Tutte le applicazioni in grado di leggere e scrivere file DWG possono fare lo stesso con file DXF, senza perdita di dati. Pertanto, richiedere file DXF invece di file DWG e fornire file DXF non dovrebbe causare problemi.
È disponibile il supporto integrato per i seguenti convertitori DWG:
Vedere Preferenze di Importa/Esporta e Importare i file DWG in FreeCAD per maggiori informazioni.
Vedere anche: Autogenerated API documentation e Script di base per FreeCAD.
Per esportare oggetti in DXF utilizzare il metodo export
del modulo importDXF.
importDXF.export(objectslist, filename, nospline=False, lwPoly=False)
filename
.Esempio:
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")