如何高亮特征
CATIA二次开发 CAA开发
本文原作者:Luca Gutierrez,经授权后转发
高亮特征
高亮在CATIA应用还是比较广泛的,尤其是面对复杂的装配环境下,通过高亮显示去引导设计人员进行操作、通过高亮显示查看效果等。在实际使用过程中可打包成公有函数方便调用。
- 1
- 2
- 3
- 4
- 5
- 6HRESULT HighLightSpecObject (CATISpecObject_var spSpec, CATBoolean boolClearHistory)
- 7{
- 8 HRESULT rc = E_FAIL;
- 9 CATFrmEditor * pEditor = CATFrmEditor::GetCurrentEditor();
- 10 if(NULL == pEditor )
- 11 return rc;
- 12 CATHSO * pHSO = pEditor->GetHSO();
- 13 if(NULL == pHSO )
- 14 return rc;
- 15 if(boolClearHistory)
- 16 pHSO->Empty();
- 17 CATPathElement pContext = pEditor->GetUIActiveObject();
- 18 CATIBuildPath * piBuildPath = NULL;
- 19 rc =spSpec->QueryInterface(IID_CATIBuildPath, (void **)&piBuildPath);
- 20 if(SUCCEEDED(rc) && piBuildPath != NULL)
- 21 {
- 22 CATPathElement * pPathElement = NULL;
- 23 rc = piBuildPath->ExtractPathElement(&pContext, &pPathElement);
- 24 if (pPathElement != NULL)
- 25 {
- 26 pHSO->AddElement(pPathElement);
- 27 pPathElement->Release();
- 28 pPathElement = NULL;
- 29 }
- 30 piBuildPath->Release();
- 31 piBuildPath = NULL;
- 32 }
- 33 return S_OK;
- 34}