.NET

Reply
Mentor
MarkPendergraft
Posts: 375
Registered: ‎06-27-2005
Message 1 of 4 (134 Views)

Modal Form Inside AutoCAD Command

134 Views, 3 Replies
01-09-2007 03:18 PM
I had the fleeting notion that it would be a good idea to add a sort of 'auto-complete' functionality to the -LAYER command.
I type everything in AutoCAD, and thought it would save some wear and tear on my wrists.
I have made similar programs, where a transparent modal form pops up, with a textbox on top, and a listbox on the bottom. As you start to type, the list box finds the entry that matches what you are typing. Essentially you can type a few letters to choose a much longer name of something.

I want to add this functionality to the -LAYER command, and the CHANGE command. However i cannot figure out how to make the program run inside the AutoCAD commands.

Would it be possible to link it to a shortcut key, say CTRL + L, or something similar, and then have the program return a value back to the AutoCAD editor?

I'm just trying to find out if anyone has any experience with this situation, before i spend hours racking my brain only to find out it can't be done.
*James Maeding
Message 2 of 4 (134 Views)

Re: Modal Form Inside AutoCAD Command

01-16-2007 08:52 AM in reply to: MarkPendergraft
just read this, I like that idea.
The only experience I have had with that kind of thing is that you can set up lisp functions and use them in a command,
like (SE) or something. Commands tend to be pretty flexible in taking a value.
I think something that put text on the clipboard might work, then you ctrl-c to past at command line.
Or, while I'm thinking, maybe you could set up a transparent command in .net that did a sendkeys to the command line. I
might just be on to something, that is what I would try first.
There is a flag for the command attribute that allows it to run transparent.
Tell us if you have any luck.

Cadkid82 <>
|>I had the fleeting notion that it would be a good idea to add a sort of 'auto-complete' functionality to the -LAYER command.
|>I type everything in AutoCAD, and thought it would save some wear and tear on my wrists.
|>I have made similar programs, where a transparent modal form pops up, with a textbox on top, and a listbox on the bottom. As you start to type, the list box finds the entry that matches what you are typing. Essentially you can type a few letters to choose a much longer name of something.
|>
|>I want to add this functionality to the -LAYER command, and the CHANGE command. However i cannot figure out how to make the program run inside the AutoCAD commands.
|>
|>Would it be possible to link it to a shortcut key, say CTRL + L, or something similar, and then have the program return a value back to the AutoCAD editor?
|>
|>I'm just trying to find out if anyone has any experience with this situation, before i spend hours racking my brain only to find out it can't be done.
James Maeding
Civil Engineer and Programmer
jmaeding - athunsaker - com
Mentor
MarkPendergraft
Posts: 375
Registered: ‎06-27-2005
Message 3 of 4 (134 Views)

Re: Modal Form Inside AutoCAD Command

01-16-2007 09:11 AM in reply to: MarkPendergraft
No luck at all. I tried the transparent flag, and it doesn't work, because the layer command uses the editor's getstring method, and interprets everything as just a string, not a command.

Lisp might work, but it would mean typeing parentheses and a command, which in turn would just about equal the amount of typeing that i'm trying to get away from. i did come up with an alternative, but it's not nearly as impressive as it could be. I just wrote a program to circumvent the set layer command, and the change properties of objects to another layer. thanks for the ideas though.
Valued Contributor
smcclure
Posts: 60
Registered: ‎06-08-2006
Message 4 of 4 (134 Views)

Re: Modal Form Inside AutoCAD Command

01-16-2007 10:33 AM in reply to: MarkPendergraft
You could try to register a listener for the event CommandWillStart under the Document object, and listen for the desired command.

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