马上注册登录,享用更多网站功能!
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
在CATIA装配模块中, 当前打开的是product. 如果用户删除了其某一个组件. 通过消息响应获得其删除组件的名字(partNumber, instanceName) .
这里用的 CATAttrNotification 消息.
现在的问题是, 无法获得删除组件的名字?
CATAttrNotification 方法: GetAttribute() . 能否从 CATISpecAttribute 获得到 CATIProduct(被删除的组件) ?
代码如下:
......
CATIProduct_var spRootProduct = spSpec;
CATISpecEvents_var spEvents = spRootProduct ;
MyEventSubscriber* pMyEventSubscriber = new MyEventSubscriber;
hr = ::AddCallback(pMyEventSubscriber ,
spEvents->GetCallbackManager(),
spEvents->GetAttrStructNotification(),
(CATSubscriberMethod)&MyEventSubscriber::OnDelete,
NULL);
......
void MyEventSubscriber::OnDelete ( CATCallbackEvent iPublishedEvent,
void *ipPublishingObject,
CATNotification *ipPublishNotification,
CATSubscriberData iUsefulData,
CATCallback iCallbackId )
{
//这里的notification 为 CATAttrNotification
CATAttrNotification *pNot = (CATAttrNotification *)ipPublishNotification;
CATBaseUnknown_var pAttr = pNot->GetAttribute( );
CATISpecAttribute_var spSpecAttr = pAttr;
....
} |