.NET

Reply
*James Maeding
Message 1 of 11 (161 Views)

Modeless dialog advice requested...

161 Views, 10 Replies
03-06-2006 10:10 AM
I have done several, what I would call, "major" programs in lisp. We are talking more than 10,000 lines of code each. I
use ObjectDCL for the dialogs, so I can write stuff that looks as good as VBA or C. Problem is, the ObjectDCL program
is third party and I am seriously worried about depending on it. So I need to see what I can use instead for progs that
have modeless dialogs, and a lot of command line interaction with users.

I have also done several large programs with VB6, so I am very familiar with how to hook up to acad through com and do
things. I have never liked the results though. Speed is one issue, but getting user input from the command line is a
bigger issue.

I am not interested in pursuing VB6 or VBA at this point, only .net or C++.

Here are my questions:

In VB6, for modeless dialogs, I would hold a reference to the acad application as one of the form's properties. Then,
anything in the diloag needing acad would be hooked to acad.
Does .net (using the .net acad API, not com) use a similar method to stay hooked with a drawing?

Or does .net run "in process" like lisp and VBA? That would be ideal I think.

With .net, how do you deal with command line access? If a modeless dialog tries to run when another command is active,
can you reliably catch the error?

I guess I am looking for someone who has actually written something using modeless dialogs and has dealt with these
issues in a real program. I need to be able to handle sloppy user interaction without crashing acad.

Thanks for any advice and feel free to redirect me to threads I missed on this.


James Maeding
Civil Engineer and Programmer
jmaeding - athunsaker - com
*Terry W. Dotson
Message 2 of 11 (163 Views)

Re: Modeless dialog advice requested...

03-06-2006 11:17 AM in reply to: *James Maeding
James Maeding wrote:

> I guess I am looking for someone who has actually written something
> using modeless dialogs ...

Have you looked at the example in the NET LABS downloadable from the
Autodesk site. Lab6/7 has a floating/dockable toolpalette and its VB.NET.

Terry
*James Maeding
Message 3 of 11 (163 Views)

Re: Modeless dialog advice requested...

03-06-2006 01:47 PM in reply to: *James Maeding
No, thats exactly the stuff I should study. I am guessing its not an actual pallette, but a dialog that you can dock...
Terry, have you delved into this, as an alternative to VBA dialogs, which I think you use for Toolpack a lot?
Kind of makes you wonder how long VBA will be around since the VB6 "mothership" is not the thing any more.

Thanks Terry.

Terry W. Dotson
|>James Maeding wrote:
|>
|>> I guess I am looking for someone who has actually written something
|>> using modeless dialogs ...
|>
|>Have you looked at the example in the NET LABS downloadable from the
|>Autodesk site. Lab6/7 has a floating/dockable toolpalette and its VB.NET.
|>
|>Terry
James Maeding
Civil Engineer and Programmer
jmaeding - athunsaker - com
*Terry W. Dotson
Message 4 of 11 (163 Views)

Re: Modeless dialog advice requested...

03-06-2006 02:17 PM in reply to: *James Maeding
James Maeding wrote:

> No, thats exactly the stuff I should study. I am guessing its not an
> actual pallette, but a dialog that you can dock...

It seems to work like properties and other newer AutoCAD dialogs.

> Terry, have you delved into this, as an alternative to VBA dialogs,
> which I think you use for Toolpack a lot?

I have only been observing from a planning stage and learning bits and
pieces. Since I make a living selling to all AutoCAD users, it will be
a few years before I can require users have 2005 or higher. Also note
that 2006 is required for modeless.

> Kind of makes you wonder how long VBA will be around since the VB6
> "mothership" is not the thing any more.

http://worldcadaccess.typepad.com/blog/2005/09/vsta_not_vista_.html

If I were in a Corporate CAD situation like you, with 2006 on all
machines, I would dive in head first!

"Adapt or die".

Terry
*Mark Gardiner
Message 5 of 11 (163 Views)

Re: Modeless dialog advice requested...

03-06-2006 04:50 PM in reply to: *James Maeding
You can do modeless dialogs in 2005 you just need to use 'setwindowlong' to
tell you form acad is the parent.

"Terry W. Dotson" wrote in message
news:5103133@discussion.autodesk.com...
James Maeding wrote:

> No, thats exactly the stuff I should study. I am guessing its not an
> actual pallette, but a dialog that you can dock...

It seems to work like properties and other newer AutoCAD dialogs.

> Terry, have you delved into this, as an alternative to VBA dialogs,
> which I think you use for Toolpack a lot?

I have only been observing from a planning stage and learning bits and
pieces. Since I make a living selling to all AutoCAD users, it will be
a few years before I can require users have 2005 or higher. Also note
that 2006 is required for modeless.

> Kind of makes you wonder how long VBA will be around since the VB6
> "mothership" is not the thing any more.

http://worldcadaccess.typepad.com/blog/2005/09/vsta_not_vista_.html

If I were in a Corporate CAD situation like you, with 2006 on all
machines, I would dive in head first!

"Adapt or die".

Terry
*Bobby C. Jones
Message 6 of 11 (163 Views)

Re: Modeless dialog advice requested...

03-07-2006 07:00 AM in reply to: *James Maeding
>>I am guessing its not an actual pallette

It is an actual palette that hosts a user control that you create. Have fun
:-)
--
Bobby C. Jones
http://www.acadx.com
*James Maeding
Message 7 of 11 (163 Views)

Re: Modeless dialog advice requested...

03-07-2006 09:42 AM in reply to: *James Maeding
this will be interesting....cool stuff
I guess the main thing I am looking at is how .net progs run inside the acad environment.
Previously, only lisp, VBA, and arx allowed this I think.

Am I right on that? Was it possible to make a dll in VB6 and somehow have it run "inside" autocad?
I thought VBA was the only way to run VB code inside acad.
thx

Bobby C. Jones
|>>>I am guessing its not an actual pallette
|>
|>It is an actual palette that hosts a user control that you create. Have fun
|>:-)
James Maeding
Civil Engineer and Programmer
jmaeding - athunsaker - com
*Bobby C. Jones
Message 8 of 11 (163 Views)

Re: Modeless dialog advice requested...

03-07-2006 10:56 AM in reply to: *James Maeding
>I guess the main thing I am looking at is how .net progs run inside the
>acad environment.
>Previously, only lisp, VBA, and arx allowed this I think.

.net does indeed "run inside" AutoCAD.

>Am I right on that? Was it possible to make a dll in VB6 and somehow have
>it run "inside" autocad?
>I thought VBA was the only way to run VB code inside acad.

ActiveX dll's can be loaded in process with AutoCAD via
acadApp.GetInterfaceObject("InsertProgIdHere") where acadApp is an instance
of the COM AcadApplication object.
--
Bobby C. Jones
http://www.acadx.com
Distinguished Contributor
jbooth
Posts: 223
Registered: ‎02-17-2006
Message 9 of 11 (163 Views)

Re: Modeless dialog advice requested...

03-08-2006 02:11 PM in reply to: *James Maeding
It was quite possible to use vb6 to automate autocad. It was also possible to have userforms that link to the autocad application. There is no difference in how it is done in .NET (fundamentally I mean).

In .NET, make a userform like you normally would, then call the Show() method of the System.Windows.Forms.Form class instead of ShowDialog(). Keep a private reference to the autocad application in the userform, and you can reference it whenever you want.

The toolbar idea is much "cooler" though - I suggest you look into that first, if it suits your purposes...
*Tony Tanzillo
Message 10 of 11 (163 Views)

Re: Modeless dialog advice requested...

03-08-2006 03:11 PM in reply to: *James Maeding
There's quite a few differences between VB6 and .NET
forms. Applications that use the .NET API for AutoCAD
must be loaded as DLLS. Standalone executables can
only use COM/ActiveX to talk to AutoCAD, and I don't
think that's what James had in mind.

In .NET applications that are loaded into AutoCAD as
DLLS and use the .NET API, Forms are not shown using
the Show() or ShowModal() methods, they're shown
using one of these methods of the Application object:

ShowModalDialog()
ShowModelessDialog()


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

wrote in message news:5105604@discussion.autodesk.com...
It was quite possible to use vb6 to automate autocad. It was also possible to have userforms that link to the autocad application. There is no difference in how it is done in .NET (fundamentally I mean).

In .NET, make a userform like you normally would, then call the Show() method of the System.Windows.Forms.Form class instead of ShowDialog(). Keep a private reference to the autocad application in the userform, and you can reference it whenever you want.

The toolbar idea is much "cooler" though - I suggest you look into that first, if it suits your purposes...

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community