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?
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.
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.
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