Class Export
- Namespace
- CADability.DXF
- Assembly
- CADability.dll
Writes the model space of a Project to a DXF or DWG file with ACadSharp. Points, lines, ellipses, polylines, splines, paths, text, dimensions, hatches and blocks become the corresponding DXF entities; faces, shells and solids are written as polyface meshes (or as MESH entities when the setting "DxfImport.UseMesh" is set). Layers, line patterns, text and dimension styles are created on demand. Export(string, string) with the formats "dxf" and "dwg" uses this class; for direct use create an instance and call WriteToFile(Project, string) or WriteToByteArray(Project).
public class Export
- Inheritance
-
Export
- Inherited Members
Constructors
Export(ACadVersion)
Creates an empty drawing of the given version with counter-clockwise angles and millimeters as units. For AutoCAD 2000 (AC1015) and older the objects that only later versions know are removed, so that strict readers accept the file. The setting "DxfDwg.ExportDimension" is read here; it decides whether dimensions are written as DIMENSION entities or as blocks.
[CLSCompliant(false)]
public Export(ACadVersion version = ACadVersion.AC1015)
Parameters
versionACadVersionthe AutoCAD version of the file; AC1015 (AutoCAD 2000) is the default and the most widely readable
Methods
WriteToByteArray(Project)
Converts the model space of toExport and returns the DXF file as bytes instead of writing it to disk,
e.g. to send it over a network. The model is the only model of the project, the model named "*Model_Space", or the
active model. Unlike WriteToFile(Project, string) single faces are written one by one and not combined
to a shell.
public byte[] WriteToByteArray(Project toExport)
Parameters
toExportProjectthe project whose model space is exported
Returns
- byte[]
the content of the DXF file
WriteToFile(Project, string)
Writes the model space of toExport as a DXF file. The model is the only model of the project, the
model named "*Model_Space", or the active model; single faces in the model are combined to one shell before they are
written. For a DWG file use Export(string, string) with the format "dwg".
public void WriteToFile(Project toExport, string filename)