Providing gumball "Align to object" for custom objects

In our C++ based Rhino5 (and newer) plugin (Symvol for Rhino), we have custom geometry derived from CRhinoObject . Our geometry has the concept of a local coordinate system, and we’d like to have the gumball act in this coordinate system when in “Align to object” mode.

I haven’t been able to find any documentation on how to do this, and the various methods I’ve tried (such as implementing CRhinoObject::GetFrame ) are not called.

Is there documentation on how to provide the object coordinate frame to the gumball? E.g. Does it depend on being able to ::Cast the CRhinoObject derived class into one of the known types? Is it based on UserData?

Hi @Peter_Newman,

What Rhino object type does your custom object inherit from?

– Dale

It inherits directly from CRhinoObject, currently. Our custom ON_Geometry class (for m_geometry) inherits from ON_Surface .

Since we do all custom rendering, we can probably change this to any other type(s) if that will facilitate.

Hi @Peter_Newman,

Make sure you’re CRhinoObject-derived class overrides both GetTightBoundingBox and InitialObjectFrame.

I should add that most who want custom objects inherit from an existing implementation. In your case, that would be CRhinoBrepObject. In doing this, the proxy Brep, maintained by your object would just handle stuff like this.

– Dale

InitialObjectFrame doesn’t appear to be in the Rhino5 or Rhino6 SDK. Based on the online documentation, that does have it, it doesn’t appear to be override’able.

https://developer.rhino3d.com/api/cpp/class_c_rhino_object.html#aa2c1b1a5cf3c614942952ca27f94c764

Description: Gets a guess at the initial object frame - this used to be the code that guesses the gumball location and orientation from the object geometry.

Returns: A plane defining the object frame.

Remarks: This is a “fake” virtual function - because I can’t extend the SDK. The implementation is to switch over the built in types and return a guessed frame. If that doesn’t work, it returns a CPlane aligned bounding box center assuming the cplane can be found for the current document view. If that fails, a world plane BB center. virtual