Different sets of custom grips for the same object?


#1

Hello,

In C++, I was wondering if I can create several kinds of custom grips for the same custom CRhinoMesh or CurveObject, and deploying them via plugin toolbars. These should be exclusive, i.e. when a set of grips is enabled, then the others are disabled.

More specifically, I’m creating a plugin to represent surfaces via several sets of polynomial functions that can be controlled through control grips. Every function has its own type of grips or handles, but they all map the surface with the same precision.

I made the code for one set of functions with a custom CRhinoMeshObject and overriding its EnableGrips, which as far as I know is connected to the default Rhino toolbar button “Point on/off”. It would be great to have a sort of EnableGrips2 and connect it to a newly created “Point2 on/off” button, with a newly coded set of custom grips, and so on. How to control this?

Many thanks!
Pablo


(Dale Fugier) #2

Hi Pablo,

Yes you can, by using CRhinoObject::EnableCustomGrips. This is how curve edit points are implemented.

But, in order to enable these types of grips, you will have to write your own “enable” command. That is, the PointsOn command will not work with these types of grips.

– Dale


#3

Hi Dale,

That sounds great! Now I think I understand it better through your rectangle grips sample.

Just one more question: why do you call
RhinoApp().RegisterGripsEnabler( m_pGripsEnabler ) ,
where m_pGripsEnabler is a pointer to CRhinoGripsEnabler, every time you enable a set of custom grips? Is this required?

Pablo


(Dale Fugier) #4

This allows Rhino to find your grip enabler when it is needed.

Yes