Table of Contents

Method SaveAs

Namespace
OpenCAD2D
Assembly
OpenCAD2D.Core.dll

SaveAs(string)

Saves the drawing to a file, which it is then known by: a DWG where its name ends in .dwg, of the version the drawing was last saved as (SaveVersion) where the DWG writer writes it, else of AutoCAD 2018, what the DWG writer does not write yet left out and said in LeftOutOfDwg; else a DXF, in the version the drawing was last saved as, its own where it was not. The file is written to a temporary file beside it and put in the place of the one there only when whole, so that a save that fails part way leaves the old file as it was. The old file is not kept as a .bak by this method; QSAVE, SAVEAS and SAVE keep it as plan.bak where ISAVEBAK is 1. The editing time and the user's timer are written into the file ($TDINDWG, $TDUSRTIMER, $USRTIMER).

public void SaveAs(string path)

Parameters

path string

The path of the file.

Exceptions

ArgumentNullException

Thrown when the path is null.

InvalidOperationException

Thrown when a group of edits is open.

SaveAs(string, IProgress<double>)

Saves the drawing to a file as SaveAs(string) does, telling how far the writing has got as a share from 0 to 1: in thousandths, never going back, 0 first and 1 at the end. A DWG tells it some 1 000 times; a DXF, written at once from its bytes, 0 and 1. A CadProgressMeter is such a progress.

public void SaveAs(string path, IProgress<double> progress)

Parameters

path string

The path of the file.

progress IProgress<double>

What is told how far it has got, on this thread; null for nothing.

Exceptions

ArgumentNullException

Thrown when the path is null.

InvalidOperationException

Thrown when a group of edits is open.

SaveAs(string, string, IProgress<double>)

Saves the drawing to a file in a version of AutoCAD, as AutoCAD 2021's Save Drawing As does with the type chosen: a DWG of R2000 (AC1015), R2004 (AC1018), R2007 (AC1021), R2010 (AC1024), R2013 (AC1027) or R2018 (AC1032) where the name ends in .dwg, as DwgWriter writes it; else a DXF of R12 (AC1009), R2000 (AC1015), R2004 (AC1018), R2007 (AC1021), R2010 (AC1024), R2013 (AC1027) or R2018 (AC1032), as Save(string, string) writes it; the version is kept in SaveVersion, so that Save() writes it again, as AutoCAD's QSAVE keeps the format of the last Save As. What a DXF of the version could not hold is said in LeftOutOfDxf, and what a DWG of it does not write yet in LeftOutOfDwg.

public void SaveAs(string path, string version, IProgress<double> progress)

Parameters

path string

The path of the file.

version string

The version, as AC1024; null for the drawing's own, and for a DWG, which is then written as AutoCAD 2018.

progress IProgress<double>

What is told how far it has got, on this thread; null for nothing.

Exceptions

ArgumentNullException

Thrown when the path is null.

ArgumentException

Thrown when the version is none of those of a DXF.

NotSupportedException

Thrown when the drawing is of R12 to R14 and the version is not its own, or a version is given for a DWG that the DWG writer does not write.

InvalidOperationException

Thrown when a group of edits is open.