.NET

Reply
Valued Contributor
dynamicscope
Posts: 95
Registered: ‎04-04-2012
Message 1 of 6 (389 Views)
Accepted Solution

How to open File Dialog and then Insert another file

389 Views, 5 Replies
04-06-2012 12:25 AM

Hello, all.

 

First, I am developing with the following system environment.

 

- ObjectARX 2011

- AutoCAD 2010

- C# with VS 2008

 

 

I am making a custom command that opens a open file dialog to prompt the user a dwg file.

And the programmatically(automatically) insert another dwg file to the opened map.

 

So what I tried to find a method to open a open file dialog, but couldn't find it.

So next I tried to execute "OPEN" command programmatically. The following code is what I tried...

 

Application.DocumentManager.MdiActiveDocument.SendStringToExecute("OPEN", false, false, false);

 

and changing the second parameter to true...

 

Application.DocumentManager.MdiActiveDocument.SendStringToExecute("OPEN", true, false, false);

 

When I run the custom command, nothing happends.

How could I do this?

 

Thank you.

 

Regards,

Jake

 

p.s. After opening a file, I want to insert ("INSERT" command) another drawing onto it. How could I achieve this?

Have a look for Tony Tanzillo's commandline class which basically replaces SendCommand with a much better version where you can put in PAUSE like in VisualLisp commands.

As I'm currently working on my photo-laptop I don't have it handy but you should find it within this forum. Otherwise send me an email and I'll flip it through to you once I'm back in the office (next week Tuesday).

Regards

Active Member
TobyRosenberg8728
Posts: 7
Registered: ‎03-14-2012
Message 2 of 6 (381 Views)

Re: How to open File Dialog and then Insert another file

04-06-2012 01:36 AM in reply to: dynamicscope

Have a look into Autodesk.AutoCAD.Windows.OpenFileDialog for selecting files.

Unfortunately I don't understand the second part of your question.

Regards

Valued Contributor
dynamicscope
Posts: 95
Registered: ‎04-04-2012
Message 3 of 6 (378 Views)

Re: How to open File Dialog and then Insert another file

04-06-2012 02:08 AM in reply to: TobyRosenberg8728

Thank you a lot~! =)

 

The second part means...

 

When you execute "INSERT" command in AutoCAD, you (the user) have to choose a file to insert and set the base point, scale, rotation.

 

So basically I want to do these steps automatically.

*Expert Elite*
Alfred.NESWADBA
Posts: 9,099
Registered: ‎06-29-2007
Message 4 of 6 (375 Views)

Re: How to open File Dialog and then Insert another file

04-06-2012 02:29 AM in reply to: dynamicscope

Hi,

 

have you searched for how to insert blockreferences within this forum?

Check >>>this<<<

 

- alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Active Member
TobyRosenberg8728
Posts: 7
Registered: ‎03-14-2012
Message 5 of 6 (369 Views)

Re: How to open File Dialog and then Insert another file

04-06-2012 02:46 AM in reply to: dynamicscope

Have a look for Tony Tanzillo's commandline class which basically replaces SendCommand with a much better version where you can put in PAUSE like in VisualLisp commands.

As I'm currently working on my photo-laptop I don't have it handy but you should find it within this forum. Otherwise send me an email and I'll flip it through to you once I'm back in the office (next week Tuesday).

Regards

Valued Contributor
dynamicscope
Posts: 95
Registered: ‎04-04-2012
Message 6 of 6 (334 Views)

Re: How to open File Dialog and then Insert another file

04-09-2012 10:20 PM in reply to: TobyRosenberg8728

Thank you a lot~!

 

"Tony Tanzillo's commandline class" works great for me.

Plus, it was easy to convert VB to C# using free online converter. =)

 

Thank you again.

 

Best Regards,

 

Jake

Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.