Intercept group creation and removal

Hi guys!
I know how to intercept object creation and removal through AddRhinoObject and DeleteRhinoObject events.
But what if I neet to catch groups creation and removal?
Is RhinoDoc.GroupTableEvent event useful?
If yes, how can I use it? Docs are not available…
Thanks to you all!

Sebastiano

Hi @software_comas,

Subscribe to the RhinoDoc.GroupTableEvent event.

For example:

/// <summary>
/// Called by Rhino when loading this plug-in.
/// </summary>
protected override Rhino.PlugIns.LoadReturnCode OnLoad(ref string errorMessage)
{
  Rhino.RhinoDoc.GroupTableEvent += OnGroupTableEvent;
  return LoadReturnCode.Success;
}

/// <summary>
/// A group table event has occurred
/// </summary>
public static void OnGroupTableEvent(object sender, Rhino.DocObjects.Tables.GroupTableEventArgs e)
{
  // TODO...
}

– Dale

Thanks @dale!
Just another question: the event exposes the GroupTableEventArgs, that contains just a RhinoDoc reference and a more useful GroupTableEventType that (I guess) describe the type of operation that raised the event.
No reference to the group?
How can I know something about the “starring” group?
How it is meant to be used?
Thanks again! :slight_smile:

Hi @software_comas,

GroupTableEventArgs.EventType indicates what type of group table event occurrred.

– Dale

Exactly!
But how can I know what group (or groups) is involved in the operation?
I think I need to know the group index or the group id, is it right?
Thanks again, @dale! :slight_smile:

Hi @software_comas,

I can see the event args only provide the type of event. I’ll add some addition properties to a future service release.

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

– Dale

1 Like

Good!
Thanks, @dale