Draft DXF/ko

설명

Draft DXF is a software module used by the Std Open, Std Import and Std Export commands to handle the DXF file format.

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.

QCAD drawing exported to DXF, which is subsequently opened in FreeCAD

가져오기(Importing)

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.

3D solids inside a DXF file are stored under a binary ACIS/SAT blob, which at the moment cannot be read by FreeCAD.


DXF importer entity support comparison
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

내보내기(Exporting)

There are also two exporters. The legacy exporter exports to the R12 DXF format, the C++ exporter to the R14 DXF format. Both formats can be handled by many applications.

DXF exporter entity support comparison
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)

Installing

For licensing reasons, the required DXF import/export libraries needed by the legacy version of the importer are not part of the FreeCAD source code. For more information see: FreeCAD and DXF Import.

Preferences

See Import Export Preferences.

DWG

DWG 형식은 특정 회사의 독점적이고 폐쇄적이며 문서화되지 않은 형식이기 때문에 FreeCAD와 같은 오픈 소스 프로젝트에서 지원하기가 어렵습니다. 바로 이러한 이유 때문에 FreeCAD는 DWG 파일을 읽고 쓰기 위해 외부 변환기를 사용합니다. DWG 파일을 가져오려면 먼저 변환기를 사용하여 DXF 파일을 생성한 다음 FreeCAD DXF 가져오기 도구에서 처리할 수 있습니다. DWG로 내보낼 때는 반대 변환이 일어납니다. FreeCAD DXF 내보내기 도구로 생성된 DXF 파일이 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.

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)

Example:

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")