Rhino get cage


#1

Is there a c++ function used to get the cage of the selected poly-surface object? Because I want to use cage vertices control object deformation.


(Dale Fugier) #2

If you have a morph control object, it is possible to get its captive objects. For example:

  CRhinoObject* object = .....

  const CRhinoMorphControl* morph_control_object = CRhinoMorphControl::Cast(object);
  if( morph_control_object )
  {
    const ON_MorphControl* morph_control = morph_control_object->Control();
    if( morph_control )
    {
      int ci, captive_count = morph_control->m_captive_id.Count();
      const ON_UUID* captive_id = morph_control->m_captive_id.Array();
      if( captive_id ) 
      {
        for( ci = 0; ci < captive_count; ci++ )
        {
          CRhinoObject* captive_object = context.m_doc.LookupObject(captive_id[ci]);
          if( captive_object )
          {
            // TODO...
          }
        }
      }
    }
  }

The SDK does not, however, provide way to find a morph control object given a “regular” geometry object such as a curve, surface, or Brep. It is possible for us to add one. But I would like to better understand what you are trying to do and why. Any details you can provide might be helpful for me.


#3

Thanks for you help. In face I have got a captive object,then I will get the captive’s boundingbox, set the boundingbox as the morph control object.