Unable to Open Autocad File which is Converted from Unigraphics NX6.

Unable to Open Autocad File which is Converted from Unigraphics NX6.

Anonymous
Not applicable
947 Views
4 Replies
Message 1 of 5

Unable to Open Autocad File which is Converted from Unigraphics NX6.

Anonymous
Not applicable

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.

0 Likes
Accepted solutions (1)
948 Views
4 Replies
Replies (4)
Message 2 of 5

norman.yuan
Mentor
Mentor
Accepted 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

Drive CAD With Code

EESignature

0 Likes
Message 3 of 5

Anonymous
Not applicable

Thank you,

It took a while for me to figure this out, but I am glad you pulled this one off for me.

 

0 Likes
Message 4 of 5

Anonymous
Not applicable

Hi,

I still see the same error. please help

 

0 Likes
Message 5 of 5

Hallex
Advisor
Advisor

Try add CommandFlags.Session to your command method

I can't rich at AutoCad today, sorry

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
0 Likes