Author Topic: A time to use 'Send Command' ?  (Read 9345 times)

0 Members and 1 Guest are viewing this topic.

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
A time to use 'Send Command' ?
« on: June 02, 2006, 12:08:59 AM »
I have been building my current application which is using a palette exclusively (so far) to handle all of my UI tasks. now I am using it in testing/production I find that I'd like to hit 'enter' to repeat the last function instead of going back and forth with the mouse.
Would this be a time to consider using Send Command (SendStringToExecute in .net api terms) in my control handlers or is there another way around it??

tia,
Mick.

P.S. my dialog variables needed to perform the required tasks is already stored in the relative class so I don't need to read these values at function execution.
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

Glenn R

  • Guest
Re: A time to use 'Send Command' ?
« Reply #1 on: June 02, 2006, 07:56:29 AM »
More information please.

Are you using a function 'behind the palette icon' or could you use a 'command' with commandline arguments (which is what I do)?

Cheers,
Me.

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: A time to use 'Send Command' ?
« Reply #2 on: June 04, 2006, 07:57:38 PM »
I'm using a stand alone palette which is basically just a dockable tabbed dialog so I don't have access to the CUI functionality.
This leaves me little choice, after some further study it seems it could present some other problems anyway so I might just give it a miss or move the functions to tool bars and menus which wouldn't be all that bad anyway.
Perhaps I could have both and give the user a choice.
Thanks.
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

Glenn R

  • Guest
Re: A time to use 'Send Command' ?
« Reply #3 on: June 04, 2006, 08:13:15 PM »
How about a 'normal' palette Mick? I use them extensively.

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: A time to use 'Send Command' ?
« Reply #4 on: June 04, 2006, 08:35:57 PM »
I haven't ventured that far as yet but may well be worth a look. I've been too busy getting the geometry and data creation right and the UI is just 'there' at the moment but usable.

So, do you create your own seperate palette set or do you just add/delete palettes to the acad version??
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

Glenn R

  • Guest
Re: A time to use 'Send Command' ?
« Reply #5 on: June 04, 2006, 08:46:15 PM »
I create my own .atc files with as many 'tabs' in them as needed and swap in/out the .atc files as required.

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: A time to use 'Send Command' ?
« Reply #6 on: June 04, 2006, 08:54:52 PM »
Thanks Glenn, more study to do!

Cheers,
Mick.
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

Glenn R

  • Guest
Re: A time to use 'Send Command' ?
« Reply #7 on: June 04, 2006, 09:35:03 PM »
Mick, I clear the palette paths in Acad Options->Files tab, then add in a new path - this creates the .atc files and structure for you.
Then you just add icons and what not...bingo - new palette.

Store on a server and write some mojo to swap (add in the path to palette path or remove as necessary) and you're good to go.

Cheers,
Glenn.

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: A time to use 'Send Command' ?
« Reply #8 on: June 04, 2006, 11:06:22 PM »
hmm, thanks Glenn.
I'm using my custom palette set as a set of modeless dialogs so I can view and change settings for different tools for 3d modelling as I use them, is there a way to put this functionality onto a tool palette?
I could have 'settings' dialogs but I don't think they would be as efficient or user friendly.

A screen shot may help -
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

Glenn R

  • Guest
Re: A time to use 'Send Command' ?
« Reply #9 on: June 05, 2006, 08:52:35 PM »
Not to my knowledge Mick - you couldn't for example put a textbox onto a standard Acad palette.

You would have to have an icon that fired the relevant 'settings' dialog if you will...if i read your question right.

BTW, that looks pretty good!

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: A time to use 'Send Command' ?
« Reply #10 on: June 05, 2006, 09:18:20 PM »
Thanks, it works ok too although there are still the usual gremlins that can only crop up in testing.
The only thing I'd like is to hit enter to re-use the last function...hence my OP.
It isn't that bad really to go and find the button again (once I get it drilling multi holes) and it's not necessary for the app to function properly so I'll leave it for now.
Cheers.
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

Bobby C. Jones

  • Swamp Rat
  • Posts: 516
  • Cry havoc and let loose the dogs of war.
Re: A time to use 'Send Command' ?
« Reply #11 on: June 06, 2006, 10:11:50 AM »
Would this be a time to consider using Send Command (SendStringToExecute in .net api terms) in my control handlers or is there another way around it??
Hey Mick,
I've just implemented this in one of my apps and it works well.
Bobby C. Jones

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: A time to use 'Send Command' ?
« Reply #12 on: June 06, 2006, 07:26:17 PM »
I did have a go with it before Bobby but couldn't get it to work. I had another go this morning and found I needed to simply place a space after the command so it 'enters' the string to execute the command.  :roll:
Here's what I have anyway, it may also need doc locking code but seems ok so far -

Code for the control event handler:
Code: [Select]
private void button6_Click(object sender, System.EventArgs e)
{     
                        //don't forget to read the arx api help for the bool flags!
Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager
.MdiActiveDocument.SendStringToExecute("TEST ",false,false,true);
                       //notice space after TEXT!
}

Demo command to handle the call for testing -
Code: [Select]
[CommandMethod("TEST")]
public static void TestStrToExecute()
{
Editor ed =
Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
ed.WriteMessage("\nExecuted string!...");

}

Thanks All.
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

Bobby C. Jones

  • Swamp Rat
  • Posts: 516
  • Cry havoc and let loose the dogs of war.
Re: A time to use 'Send Command' ?
« Reply #13 on: June 06, 2006, 11:16:44 PM »
Here's what I have anyway, it may also need doc locking code but seems ok so far -
Hey Mick,
This looks like what I've got.  I've got code with and without document locking and, like your testing, they both work.  I assume that the SendStringToExecute() method is handling the locking???
Bobby C. Jones

Glenn R

  • Guest
Re: A time to use 'Send Command' ?
« Reply #14 on: June 07, 2006, 12:58:01 AM »
I guess that the sent command is executing in the document context so it is implicitly locked, whereas from the application context you have to explicitly lock....