Hello all,
I have to open the files which are converted from Unigraphics NX6, and run some routines, but I am not able to open the Autocad through .net api, my code is as follows
Dim Filename As String = OpenFileToConvert.FileName ' I am selecting the Dwg through OpenFileDialog
Dim acDocMgr As DocumentCollection = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager
acDocMgr.Open(Filename, False)
Even if I open the dwg manually and then save it again to Autocad, I am not able to achieve any success.
And I would be glad if someone suggests me a code to work with, without open the file at all.
Herewith I am attaching the sample file which I am not able to open through vb.net in Autocad.
Solved! Go to Solution.
Solved by norman.yuan. Go to Solution.
Using AutoCAD 2012, I do not have issue opening your drawing manually, or by code like this:
Document dwg=Application.Documentmanager.Open(@"C:\Temp\Model1.dwg");
or read it into a database (i.e. not open the drawing in editor):
using (Database db=new Database(false, true))
{
db.ReadDwgFile(@"C:\Temp\Model1.dwg", FileOpemMode.OpenForReadAndAllShare, true, null);
}
Norman Yuan
Thank you,
It took a while for me to figure this out, but I am glad you pulled this one off for me.
Try add CommandFlags.Session to your command method
I can't rich at AutoCad today, sorry