2014-07-14 19:24:13|?次阅读|上传:wustguangh【已有?条评论】发表评论
关键词:C/C++, CAA, CATIA|来源:唯设编程网
在使用CAA进行CATIA V5R19二次开发时,如果对零件结构进行了改变,即结构树信息发生了变化,你就需要对结构树进行刷新重绘,否则结构树显示的信息就和实际的数据模型不一致。
下面给出刷新装配体结构树的源代码:
//刷新装配结构树
HRESULT BasicGlobalFunc::RedrawSpecTree(CATIProduct_var& iNodeProd){
if(iNodeProd == NULL_var)return E_FAIL;
CATIModelEvents_var spModleEventOnProduct(iNodeProd);
CATModify event(iNodeProd);
spModleEventOnProduct->Dispatch(event);
CATIRedrawEvent_var spRedrawEventOnProduct(iNodeProd);
spRedrawEventOnProduct->Redraw();
return S_OK;
}
实现结构树的刷新主要使用CATModelEvents接口和CATIRedrawEvent接口。
CATIModelEvents实现组件与它们的显示层进行通信,API帮助信息如下:
Interface that makes components communicate with their visualization, that is their graphical representations。
而CATIRedrawEvent接口实现在需要的时候对结构树进行重绘:
Interface to allow a graph to redraw when desired。