.NET

.NET

Reply
Contributor
jamkhp
Posts: 24
Registered: ‎05-19-2011
Message 1 of 5 (373 Views)
Accepted Solution

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

373 Views, 4 Replies
12-06-2011 04:04 AM

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.

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);

}

 

 

*Expert Elite*
norman.yuan
Posts: 1,064
Registered: ‎04-27-2009
Message 2 of 5 (362 Views)

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

12-06-2011 07:15 AM 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);

}

 

 

Contributor
jamkhp
Posts: 24
Registered: ‎05-19-2011
Message 3 of 5 (349 Views)

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

12-06-2011 10:04 AM 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.

 

Contributor
jamkhp
Posts: 24
Registered: ‎05-19-2011
Message 4 of 5 (308 Views)

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

12-16-2011 05:01 AM in reply to: jamkhp

Hi,

I still see the same error. please help

 

*Expert Elite*
Hallex
Posts: 1,569
Registered: ‎10-08-2008
Message 5 of 5 (298 Views)

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

12-16-2011 06:33 AM in reply to: jamkhp

Try add CommandFlags.Session to your command method

I can't rich at AutoCad today, sorry

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.