Custom Objects - raise event on GripsOn, notice _pointsOn Command (solved)

i’m trying to implement a Custom Curve Object and keep track of changes.
How can i capture, if the user turn s on controlpoints with the command “_pointsOn”;
I tried to override the GripsOn Property - but that does not work.

thank s for any hint

    public new bool GripsOn
        {
            get
            {
                Rhino.RhinoApp.WriteLine("MyCustomObj GripsOn Get");
                return base.GripsOn;
            }
            set
            {
                Rhino.RhinoApp.WriteLine("MyCustomObj GripsOn Set");
                base.GripsOn = value;
            }
        }

You can do something like this (it is in vb should be easy to translate):

AddHandler Rhino.Commands.Command.BeginCommand, AddressOf StartOfCommand
AddHandler Rhino.Commands.Command.EndCommand, AddressOf EndOfCommand

   Private Sub StartOfCommand(ByVal sender As Object, ByVal e As Rhino.Commands.CommandEventArgs)
         If e.CommandEnglishName = "PointsOn" Then
               msgbox(e.CommandEnglishName)
        End If
    End Sub

    Private Sub EndOfCommand(ByVal sender As Object, ByVal e As Rhino.Commands.CommandEventArgs)
         If e.CommandEnglishName = "PointsOn" Then
               msgbox(e.CommandEnglishName)
        End If
    End Sub

You can add the handdlers somewhere and it will keep track if the pointson command is used.

many thanks. this will do it.

Hi everybody,
I am trying to do the same (in c++, but i guess it is the same). I came out with the same solution but the problem is that it is possible to do turn off the grips also pressing ESC but this does not raise any event. Do you know how to intercept such event?
Thanks in advance.

Hi @gennaro,

For custom objects, the CRhinoObject::EnableGrips method is called when grips are enabled and disabled.

– Dale

Hi Dale,

it means that I have to iterate over all objects to know if the grips are disabled or enabled? there is no event?

Gennaro

Hi @gennaro,

Like I said, Rhino will call your object’s CRhinoObject::EnableGrips method is called when grips are enabled and disabled. I don’t understand the “iterate” comment.

– Dale

Sorry Dale,
I try to explain better what I meant. I need the PointsOn and PointsOff event. The idea presented above by jordy1989 works fine but does not intercept the PointsOff event when it is triggered by the ESC button. I was already checking the EnableGrips method iterating on all objects to see if the state is changed but I would prefer to have an event to know if the PointsOn/Off has been executed on any object in the document.