Selection Events and moving objects

I use RhinoDoc.SelectObjects and RhinoDoc.DeselectAllObjects events to control the content of the HumanUI window. Thus when a user selects a curve in Rhino some kind of a property window appears.

It works fine untill the objects are moved (or rotated) in Rhino. It seems that a simple move fires selection events multiple times and everything lags quite significantly. Selecting and moving several objects simultaniously results in a quite a parade of lagging. It looks quite funny though.

The best idea I came up with so far is to unsubscribe my event handlers directly before the transformation using RhinoDoc.BeforeTransformObjects event. The problem is there’s no “AfterTransformation” event, so I can’t subscribe back. It drives me crazy, please help.

Hi Archimax,

A good approach could be set a flag from RhinoDoc.SelectObjects and RhinoDoc.DeselectAllObjects events (a static bool) and process it on Rhino Idle like that:

private static bool _doStuff;
public void RhinoSelectedObjs(object sender, eventArgs e)
{
  _doStuff = true;
}

public void RhinoOnIdle()
{
  if (!_doStuff) return;
  _doStuff = false;
  //Do your stuff only one time
}

OnIdle event will be raised in loop when Rhino finish a job, (in this case select or unselect N objects)

Hope it help you.
Regards

1 Like

Thanks Harper,

Basically Idle is the event I was looking for. Couldn’t find it since it’s a part of RhinoApp instead of RhinoDoc.