Table of Contents

Method Save

Namespace
GeometryHelper.Dxf
Assembly
GeometryHelper.dll

Save(string)

Saves the drawing to a path, replacing whatever is there: the bytes read where nothing was changed, and each record not changed, added or erased with its own bytes where something was; a face of a polyface mesh read with AcDbVertex before its AcDbFaceRecord, as GeometryHelper 13.0.0 and 13.1.0 wrote one and AutoCAD 2021 refuses, is written with its own marker alone. Filename is the path from then on, as AutoCAD's SaveAs makes it.

public void Save(string path)

Parameters

path string

The path of the file.

Exceptions

ArgumentNullException

Thrown when the path is null.

IOException

Thrown when the file cannot be written.

Save(Stream)

Saves the drawing to a stream, where it stands, as Save(string) saves it.

public void Save(Stream stream)

Parameters

stream Stream

The stream; it is written to and left open.

Exceptions

ArgumentNullException

Thrown when the stream is null.

Save(string, string)

Saves the drawing to a path in a version of AutoCAD, as AutoCAD's SaveAs(path, version) does, replacing whatever is there: R12 (AC1009), R2000 (AC1015), R2004 (AC1018), R2007 (AC1021), R2010 (AC1024), R2013 (AC1027) or R2018 (AC1032). The drawing in the memory stays as it is, of its own version; Filename is the path from then on.

public IReadOnlyList<string> Save(string path, string version)

Parameters

path string

The path of the file.

version string

The version, as Version names it, letters of either case.

Returns

IReadOnlyList<string>

What could not be written in the version, a sentence each: the kinds left out and the kinds written another way; empty where nothing was.

Remarks

A drawing saved in its own version is written as Save(string) writes it, byte for byte. Saved in another, every kind of entity and object stays, as AutoCAD keeps them when it saves an older version, with the groups the version has: the header variables, the true colours and transparency before R2004, the background of an MTEXT, the gradient of a hatch, the lighting of a viewport and the other groups a later version brought are left out, and the counts of each class of objects, which AutoCAD opens no drawing from R2004 on without, are made. A drawing of R2000 saved as R2018 is given what R2018 writes that it did not hold, and no more.

What cannot be given the form of the older version is left out or written another way, and said in the result: a table, whose cells are in a form of their own on either side of R2007, is written as the block it is drawn with; the visual styles, which have a form of their own in each version but R2013 and R2018, are left out, and AutoCAD makes its own on opening; the ACIS body of a solid of R2013 or later, binary, cannot be written as the text of R2010 and before (a REGION it can: its body is read and written again for each version, SAT text up to R2010 and the data store from R2013); the columns of an MTEXT and the lines of an attribute, which R2018 holds in an object embedded in it, are written as R2013 writes them. Text beyond the code page of a drawing before R2007 is written as the escapes \U+XXXX, as Parse(string) keeps it.

R12 has no objects, no classes, no layouts beyond one paper space, no handles but those of its entities, and a few of the kinds of entity: it is written as AutoCAD 2021 writes one drawing as R12. The header, the tables (no block records, no handles, no extended data, names as R12 holds them, a TrueType font named txt, a dimension style with every value) and the groups of each entity are those of R12; the spaces are the blocks $MODEL_SPACE and $PAPER_SPACE; a viewport keeps its view in its extended data (ACAD MVIEW). What R12 lacks is broken into what it holds: an LWPOLYLINE is a POLYLINE, an ellipse (129 vertices) and a spline (128) a 3D POLYLINE, a ray and an infinite line a LINE to the extents of the drawing; an MTEXT (its words laid out in the FontSearchPath of the drawing, so that a long one is wrapped as AutoCAD wraps it), a pattern HATCH, a LEADER, a MULTILEADER, an MLINE, a table, a MESH (its edges) and a HATCH filled solid or with a gradient (its SOLIDs, one colour for a gradient) are the entities they break into, and a 3DSOLID and a REGION the lines, circles, arcs, points and 3D polylines of the edges of their faces (a box 40 by 30 by 20 is 24 LINEs; an edge that is a spline is left out), in a block *U or *X numbered on in the order of the handles, where they stood in a space and where they stood in a block alike (a ray and an infinite line in a block are a LINE of no length); the INSERT is on the current layer and in the current colour of the drawing, and that of a hatch holds the hatch as R14 did in its extended data (ACAD HATCH, R14_HATCH_DATA), that of a multileader its version (ACAD_MLEADERVER). A dynamic block is written as the anonymous block *U AutoCAD gives it, and a name R12 does not allow is an underscore for each character it does not and cut to 26 characters. A TOLERANCE, a WIPEOUT, an IMAGE, an underlay, an OLE frame and the layouts beyond the first are left out, and said.

Exceptions

ArgumentNullException

Thrown when the path or the version is null.

ArgumentException

Thrown when the version is none of those seven.

NotSupportedException

Thrown when the drawing is of R12 to R14 and the version is not its own: its records are not those of R2000 and later, and are saved as they are.

IOException

Thrown when the file cannot be written.

Save(Stream, string)

Saves the drawing to a stream, where it stands, in a version of AutoCAD, as Save(string, string) saves it.

public IReadOnlyList<string> Save(Stream stream, string version)

Parameters

stream Stream

The stream; it is written to and left open.

version string

The version, as Version names it.

Returns

IReadOnlyList<string>

What could not be written in the version, a sentence each; empty where nothing was.

Exceptions

ArgumentNullException

Thrown when the stream or the version is null.

ArgumentException

Thrown when the version is none of those seven.

NotSupportedException

Thrown when the drawing is of R12 to R14 and the version is not its own.