C++ equivalent of ObjectAttributes.AddHideInDetailOverride

Hi,

is it possible in c++ (without scripting) to hide an object in a specific detail view like in ObjectAttributes.AddHideInDetailOverride ?

thanks

Hi @dsw,

I have not test this, but it should work.

/// <summary>
/// Hides a Rhino object in a detail view.
/// </summary>
/// <param name="pObject">The object to hide in a detail.</param>
/// <param name="detailId">The id of the detail object's viewport.</param>
/// <returns>True if successful, false otherwise.</returns>
bool RhHideObjectInDetail(CRhinoObject* pObject, ON_UUID detailId)
{
  bool rc = false;
  if (pObject)
  {
    CRhinoDoc* pDoc = pObject->Document();
    if (pDoc)
    {
      ON_3dmObjectAttributes attributes = pObject->Attributes();
      ON_DisplayMaterialRef dmr;
      dmr.m_display_material_id = ON_DisplayMaterialRef::m_invisible_in_detail_id;
      dmr.m_viewport_id = detailId;
      rc = attributes.AddDisplayMaterialRef(dmr);
      if (rc)
        rc = pDoc->ModifyObjectAttributes(CRhinoObjRef(pObject), attributes, TRUE);
    }
  }
  return rc;
}

– Dale

1 Like

Thanks @dale, it works.

Although i would never have searched in the display material attributes. :thinking: