Rhino v5 plugin, common digitizer

Hi, i want create a common plugin digitizer in c#, but I don’t understand the control flow about the functions EnableDigitizer & calibration, and how send correctly the points ( digitizer event , aka mouse buttons ). Basically how the common plugin should works. I translate the control flow from the cpp example to my common plugin in c#, but looks weird when i disconnect the digitizer (i cant reconnect again). Where can i find a full example about the digitizer in c#?, the example from the “RhinoCommon templates for v5” , are not enough for me :frowning: . thank you. ( sorry for my english )

Hi Ignacio,

We don’t have a sample 3D digitizer plug-in for C#. But we do have a sample 3D digitizer plug-in for C++ that is well commented:


Does this help?

– Dale

OK, thank you. Actually I’m using that example. But I don’t understand, how can I implement the “Digitizer Normal Line”?. Is using the method “SendPoint”?. Thanks. Actually the other digitizer functions like “Multiple Points” & “Curve” are done automatically.

I think you want to call DigitizerPlugin.SendRay.

– Dale

Thank you. Its me again :slight_smile: , How often I can call SendRay?, I found that I should call this function each 33ms. If I call this function more frequently ( < 33 ms ) the “Ray” is not sent correctly ( the point appears after 5 seconds or more, or doesn’t appear, and the digitizer toolbar buttons are frozen ). Thank you.

The digitizers that Rhino currently supports send a point every 15 milliseconds or so. They also do so from a different thread (than Rhino’s main thread).

Im using the original SampleDigitizer project from the GitHub. Im playing with the function “ThreadProc” initialized when the digitizer is started. When i set a delay in each iteration of 100ms, the interface responds well, but, when i set a delay of 20 ms, the interface looks frozen, ( does not respond to my keyboard and mouse, and i cant switch of tool, but the 3d coordinates are refreshing in the 3d scene ). What am I doing wrong? :tired_face: . What handle waits “WaitForSingleObject”?

This is the code. ( all the rest of code, is the original project)

static DWORD WINAPI ThreadProc( LPVOID pVoid )
  CSampleDigitizerPlugIn* pPlugIn = (CSampleDigitizerPlugIn*)pVoid;
  ASSERT( pPlugIn );

  while( 1 )
	Sleep( 100 ); // 100ms or 20ms
	ON_3dPoint pt = ON_3dPoint( rand(), rand(), rand() );  // random point
	pPlugIn->SendPoint( pt, 0 );
  return 0;