Execute a rhino command from a "Digitizer plug-in"

Hi!.
Im creating a “digitizer plug-in”, but i need execute a rhino command, specifically “_DigDisconnect”. How can I do this, inside my plugin code?. Actually my digitizer is a named pipe service, and when the server goes off, and the digitizer is enabled, i need disconnect the digitizer. Thanks.

Is there a reason you cannot just call your digitizer plug-in’s Rhino.PlugIns.DigitizerPlugIn.EnableDigitizer override?

– Dale

Yes, It was the first thing i did, but the digitizer is still connected, the “Command: _Digitize” is still active, when I call the function “EnableDigitizer( false )”. I need disconnect the digitizer, in that way I could re-connect the digitizer, once the server is active again. Or what function should I call to disconnect the digitizer to do something like the “Command _DigDisconnect”. Thanks.

Sure, you could also script the DigDisconnect command…

Yes, but how can I run this Rhino.Commands.Command from code?

http://developer.rhino3d.com/guides/rhinocommon/run_rhino_command_from_plugin/

Yes thank you!, I read that before post!. The command function works when I run the command from the rhino console!. But I need run that from my digitizer plug-in class. How can I access to the RunCommand function from my digitizer class?

Ok, I solved the problem with the function “SendKeystrokes”, in this way I can send the command “_DigDisconnect” to the rhino console. But is a weird solution. Thank you.

I’m confused, why don’t you just call RhinoApp.RunScript?

I try it inside my DigitizerPlugIn Class, but doesn’t work. And I created a command (RunCommand from Command class ) with the function RhinoApp.RunScript, but this just creates a command to be execute from the Rhino console. Or what I misunderstanding?, Thank you.

Does this work any better?

RhinoApp().DigitizerManager().DisconnectDigitizer();

Yes!, in C++ that works fine!. But I’m working with RhinoCommon .NET SDK v5, and i cant find something like that! in RhinoCommon.
I’m using the rhinocommon wizard from this link https://visualstudiogallery.msdn.microsoft.com/16053049-7db2-4c9f-961a-53274ac92ace

Hi Ignacio,

The C++ function I mention above is not exposed in RhinoCommon. Perhaps the “SendKeystrokes” approach is sufficient for now?

– Dale

Is sufficient for now!, the only problem is when the console is not active. When the rhino console is not active the function “SendKeyStrokes” doesn’t work. That is the only problem.

I can add something to the Rhino WIP:

https://mcneel.myjetbrains.com/youtrack/issue/RH-36303

But we are no longer working on Rhino 5.

– Dale