Visual LISP, AutoLISP and General Customization

Posts: 3
Registered: ‎10-19-2011
Message 1 of 7 (3,881 Views)
Accepted Solution

How to save *.DWG format to *.DXF format

3881 Views, 6 Replies
10-19-2011 05:15 AM

Hi, I am new to AutoCAD Customization (using C#). I am trying to save a *.DWG file to *.DXF format. The DXF file is created, but when i tried to open the same DXF file in AutoCAD,it is showing as "not a Valid DXF file".


Code :

// Open *.DWG file


// Save to *.DXF format


// Close and discard changes,if any



ONE MORE THING... When i used the saveas command in Autocad, it is showing different dxf file formats(AutoCAD 2010 DXF,AutoCAD 2007 /LT 2007 DXF etc..). How to save in particular DXF format. If possible give me a sample C# code for this.


Thanks in Advance,

Venkata Ramesh V




ADN Support Specialist
Posts: 185
Registered: ‎08-25-2004
Message 2 of 7 (3,841 Views)

Re: How to save *.DWG format to *.DXF format

10-19-2011 11:48 AM in reply to: Ramesh_venkat



Try using  the DxfOut function of the database. Here is a C# example that saves a DXF to an older format.


static public void My_dxfout12()
Database db = Application.DocumentManager.MdiActiveDocument.Database;
int precision = 16;
db.DxfOut("r12.dxf", precision, DwgVersion.AC1009);


You can set the drawing version using the Autodesk.AutoCAD.DatabaseServices.DwgVersion.  


Also for AutoCAD .NET questions I would suggest posting in the .NET  discussion group.



Wayne Brill

Autodesk Developer Network

Wayne Brill
Developer Technical Services
Autodesk Developer Network

Posts: 3
Registered: ‎10-19-2011
Message 3 of 7 (3,819 Views)

Re: How to save *.DWG format to *.DXF format

10-20-2011 04:19 AM in reply to: wayne.brill

Hi Wanye,

   Its working, i tried the same DXFout fucntion last night, but had a doubt that time regarding the Version. I thought like the DWGVersion means the Version of the file that we are going to Save. Anyways things are clear now.Finally 2 small things to clarify


1. I checked the ObjectARX for AutoCAD 2011 for "DwgVersion Enumeration" where in i found something like AC1001 = 8, AC1002 = 9..etc but i couldn't make any sense which one belongs to which version(like AC1001 for 2010,AC1002 for 2007 etc..) So where can i get this help.


2. While i'm searching for this DXFOut function i came across "GetSupportedDXFOutVersions()" , it is returning

AC1800,AC1015,AC1012(i'm using AutoCAD 2011). I thought that i can save my DWG file to DXF in only mentioned three formats(Versions). but i'm able to use all the Versions while saving to DXF,instead of only above mentioned three versions.

i.e i can use

Autodesk.AutoCAD.DatabaseServices.DWGVersion.AC1024 (even though GetSupportedDXFOutVersions() didnt returned the value AC1024).

If possible please clarify/Brief me on this.


Thanks for the DIscussion_Admin(Group/Member) for moving my post to right place and Thanks for your advice wyane.From now i will post these type of things in .NET forum.


Venkata Ramesh V

Valued Mentor
Posts: 262
Registered: ‎11-29-2008
Message 4 of 7 (3,813 Views)

Re: How to save *.DWG format to *.DXF format

10-20-2011 06:11 AM in reply to: Ramesh_venkat

>>> If possible please clarify





class keyThumper<T> : Lazy<T>;      another  Swamper

Posts: 3
Registered: ‎10-19-2011
Message 5 of 7 (3,794 Views)

Re: How to save *.DWG format to *.DXF format

10-20-2011 10:32 PM in reply to: KerryBrown

Thanks Kerry for the link. I checked the link, found some helpfull stuff there. I found almost all the enum's, but i couldn't found

AC1800 which my GetSupportedSaveVersions() returned when i called it in AutoCAD-2011 environment. Any idea on this enum.


Thanks for the help.


Venkata Ramesh V

Valued Mentor
Posts: 262
Registered: ‎11-29-2008
Message 6 of 7 (3,770 Views)

Re: How to save *.DWG format to *.DXF format

10-21-2011 05:22 PM in reply to: Ramesh_venkat


The enumerators are



[Wrapper("AcDb::AcDbDwgVersion ")]
public enum DwgVersion
    AC1001 = 8,
    AC1002 = 9,
    AC1003 = 10,
    AC1004 = 11,
    AC1005 = 12,
    AC1006 = 13,
    AC1007 = 14,
    AC1008 = 15,
    AC1009 = 0x10,
    AC1010 = 0x11,
    AC1011 = 0x12,
    AC1012 = 0x13,
    AC1013 = 20,
    AC1014 = 0x15,
    AC1015 = 0x17,
    AC1021 = 0x1b,
    AC1024 = 0x1d,
    AC1500 = 0x16,
    AC1800 = 0x19,
    AC1800a = 0x18,
    AC1To2 = 1,
    AC1To40 = 2,
    AC1To50 = 3,
    AC2100a = 0x1a,
    AC2400a = 0x1c,
    AC2To10 = 5,
    AC2To20 = 4,
    AC2To21 = 6,
    AC2To22 = 7,
    Current = 0x1d,
    Max = 0x7fff,
    MC0To0 = 0,
    Newest = 0x1d,
    Unknown = 0x7ffe

 My short research indicates AC1800 represents 2004





class keyThumper<T> : Lazy<T>;      another  Swamper

Active Member
Posts: 8
Registered: ‎12-20-2012
Message 7 of 7 (2,709 Views)

Re: How to save *.DWG format to *.DXF format

01-11-2013 05:09 PM in reply to: KerryBrown

Version history

Version Internal version AutoCAD versions
DWG R1.0MC0.0AutoCAD Release 1.0
DWG R1.2AC1.2AutoCAD Release 1.2
DWG R1.40AC1.40AutoCAD Release 1.40
DWG R2.05AC1.50AutoCAD Release 2.05
DWG R2.10AC2.10AutoCAD Release 2.10
DWG R2.21AC2.21AutoCAD Release 2.21
DWG R2.22AC1001, AC2.22AutoCAD Release 2.22
DWG R2.50AC1002AutoCAD Release 2.50
DWG R2.60AC1003AutoCAD Release 2.60
DWG R9AC1004AutoCAD Release 9
DWG R10AC1006AutoCAD Release 10
DWG R11/12AC1009AutoCAD Release 11, AutoCAD Release 12
DWG R13AC1012AutoCAD Release 13
DWG R14AC1014AutoCAD Release 14
DWG 2000AC1015AutoCAD 2000, AutoCAD 2000i, AutoCAD 2002
DWG 2004AC1018AutoCAD 2004, AutoCAD 2005, AutoCAD 2006
DWG 2007AC1021AutoCAD 2007, AutoCAD 2008, AutoCAD 2009
DWG 2010AC1024AutoCAD 2010, AutoCAD 2011, AutoCAD 2012
DWG 2013AC1027AutoCAD 2013

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community