How to read DWG files directly without running AutoCAD

How to read DWG files directly without running AutoCAD

Anonymous
Not applicable
822 Views
1 Reply
Message 1 of 2

How to read DWG files directly without running AutoCAD

Anonymous
Not applicable
I have encountered the following problems in practical work: users do not want to open AutoCAD for operation, but just want to read the data in the DWG file.
 
After we reference the API, the code is written and compiled, but the object created by the API class will cause system.invalidprogramexception
 
The specific code is as follows:
 
Autodesk.AutoCAD.DatabaseServices.Database database = new Autodesk.AutoCAD.DatabaseServices.Database ( false , true );
 
string dwgFilePath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "now.dwg";
 
database.ReadDwgFile ( dwgFilePath , Autodesk.AutoCAD.DatabaseServices.FileOpenMode.OpenForReadAndAllShare , false , "" );
 
database.CloseInput ( true );
 
Transaction transaction = database.TransactionManager.StartTransaction ( );
0 Likes
823 Views
1 Reply
Reply (1)
Message 2 of 2

Henry.Huang
Autodesk Support
Autodesk Support

The Customization question should post on the 

 

AutoCAD Customization

 

Thanks. 

 




Henry Huang
Product Support Specialist, Frontline Technical Support
Customer Service and Support, GCSO
Autodesk, Inc.

0 Likes