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

rhinocommon

#1

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.


(Dale Fugier) #2

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

– Dale


#3

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.


(Dale Fugier) #4

Sure, you could also script the DigDisconnect command…


#5

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


(Dale Fugier) #6

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


#7

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?


#8

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.


(Dale Fugier) #9

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


#10

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.


(Dale Fugier) #11

Does this work any better?

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

#12

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


(Dale Fugier) #13

Hi Ignacio,

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

– Dale


#14

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.


(Dale Fugier) #15

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