.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
jamkhp
733 Views, 4 Replies

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

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.

4 REPLIES 4
Message 2 of 5
norman.yuan
in reply to: jamkhp

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

Message 3 of 5
jamkhp
in reply to: 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.

 

Message 4 of 5
jamkhp
in reply to: jamkhp

Hi,

I still see the same error. please help

 

Message 5 of 5
Hallex
in reply to: jamkhp

Try add CommandFlags.Session to your command method

I can't rich at AutoCad today, sorry

_____________________________________
C6309D9E0751D165D0934D0621DFF27919

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost