I have kind of a dumb idea and I speculate that the quickest route to testing it out would be to somehow just capture everything going on in the command line in realtime (and then do something something.) Is that…possible, is there an event I can just hook in to? Otherwise I’d have to, I dunno, roll my own command line, which I suppose is what I’d eventually have to do but sounds pretty daunting…
I don’t think you can do this directly, but there might be a less extreme workaround. What are you trying to do by reading the command line?
That would be telling, lol, but eventually I would like to as I mention “roll my own command line,” but for a first test it would be enough to just echo what’s going on with it somewhere else…
Alright then, a way too verbose response:
You can subscribe to RhinoEtoApp.MainWindow.KeyDown and hook it up to a string that is built key-by-key whenever the main window has focus, or maybe clear or lock it whenever Rhino.Commands.Command.BeginCommand and EndCommand are fired. This would give you a pretty close idea of when the document is waiting for a command, which is when you would need to build the string that would correspond to the command line.
If you want to record the commands themselves, the BeginCommand event gives you info as to the current command being run, so you can record the english names of the commands as their being run.
If you want to record the options that the user is picking for a command, I’m pretty sure that cannot be recorded as that is happening inside the command and (from experience) are not really exposed to the user, but that’s only if the user clicks the icon. Reading the key press should work as when described as above, though you would need to make sure that the English name of the command that you run matches the one that you are looking for.
In terms of writing your own command line, it would be somewhat trivial. You just need to have a command that opens a form with a Textbox control on it, and subscribe to the TextChanged event. From here, you can read the text in the TextBox just using TextBox.Text - you can even add masks to restrict the user input if you wish. If the user presses enter, you can have it run RhinoApp.RunScript with the text from the TextBox.
Hopefully this is remotely helpful.
That might be helpful, thanks!
This may help
// Enable Capture
RhinoApp.CommandWindowCaptureEnabled = true;
// Do stuff
// Read what happened
RhinoApp.CapturedCommandWindowStrings
// Reset
RhinoApp.ClearCommandHistoryWindow();
// Repeat!
See also this recent post: