ACadSharp icon indicating copy to clipboard operation
ACadSharp copied to clipboard

Code sample : how to convert a DWG to a ASCII DXF and select the ACAF version

Open mlcvista opened this issue 1 year ago • 2 comments

First, big thank you for your ACADSHARP.

I'm trying to use it to convert DWG to ASCII DXF...

I've use this code :

const string _file = "../../../../samples/sample_AC1032.dwg"; const string _filedxf = "../../../../samples/sample_AC1032_mlc.dxf";

static void Main(string[] args) { CadDocument doc; using (DwgReader reader = new DwgReader(_file)) { doc = reader.Read(); }

//exploreDocument(doc);

using (DxfWriter writer = new DxfWriter(_filedxf, doc,false))
{
	writer.OnNotification += NotificationHelper.LogConsoleNotification;
	writer.Write();
}

}

The dxf created is ASCII one... how to select the ACAD version of DXF if I want one, Please ?

With best regards, MLC

mlcvista avatar Dec 19 '23 15:12 mlcvista

Hi @mlcvista,

If you want to save the document in a different version just change the version in the header:

//Example
doc.Header.Version = ACadVerson.AC1018;

Thanks for your support.

DomCR avatar Dec 19 '23 16:12 DomCR

Great ! This project is very good ! a must one :)

mlcvista avatar Dec 19 '23 17:12 mlcvista