如何隐藏元素
CATIA二次开发 CAA开发 
本文原作者:Luca Gutierrez,经授权后转发
隐藏元素
使用CAA隐藏CATIA中的元素,首先需要通过QueryInterface函数得到对应元素的CATIVisProperties接口,然后调用CATIVisProperties接口的SetPropertiesAttr函数设置元素的显示属性。由于在实际开发工程中,经常用到隐藏或显示CATIA中的元素,所以可将其打包成公用函数方便调用。
- 1 
 - 2 
 - 3 
 - 4 
 - 5 
 - 6void HideElements(CATLISTV(CATISpecObject_var) ipListElemObj) 
 - 7{ 
 - 8    for(int i=1;i<=ipListElemObj.Size();i++){ 
 - 9        CATIVisProperties* pPropOnElem = NULL; 
 - 10        HRESULT rc = ipListElemObj[i]->QueryInterface(IID_CATIVisProperties, 
 - 11            (void**)&pPropOnElem); 
 - 12        if(NULL != pPropOnElem){ 
 - 13            CATVisPropertiesValues PropValue; 
 - 14            CATVisPropertyType PropTypeOnPtObj = CATVPShow; 
 - 15            CATVisGeomType GeomTypeOnPtObj = CATVPGlobalType; 
 - 16            PropValue.SetShowAttr(CATNoShowAttr); 
 - 17            rc = pPropOnElem->SetPropertiesAtt(PropValue, 
 - 18                PropTypeOnPtObj, 
 - 19                GeomTypeOnPtObj); 
 - 20            pPropOnElem->Release(); 
 - 21            pPropOnElem = NULL; 
 - 22        } 
 - 23    } 
 - 24}