找回密码
 注册
查看: 860|回复: 0

[分享] CATAI二次开发 获取当前模型

[复制链接]
发表于 2015-7-15 21:30:02 | 显示全部楼层 |阅读模式
CATIProduct_var GetCurrentPrdInstance()


{

     CATIProduct_var spPrdInstance=NULL_var;
    //获得当前editor

     CATFrmEditor* editor = CATFrmEditor::GetCurrentEditor ();

     if (NULL == editor)

         return spPrdInstance;

     //获得当前文档

     CATDocument* pCurDoc= editor-> GetDocument();

     if (NULL == pCurDoc)

         return spPrdInstance;

     if(pCurDoc->IsAKindOf("CATProduct")==0)

         return spPrdInstance;

     CATPathElementpath=editor->GetUIActiveObject();

     if(path.GetSize()==0)

         return spPrdInstance;

     CATIProduct* pPrdInstance=NULL;

     HRESULT rs=path.Search(IID_CATIProduct,(void**)&pPrdInstance);

     if (FAILED(rs) || pPrdInstance==NULL)

         return spPrdInstance;

     spPrdInstance=pPrdInstance;

     pPrdInstance->Release();

     pPrdInstance=NULL;

     //

     return spPrdInstance;

}


您需要登录后才可以回帖 登录 | 注册

本版积分规则

本站无意传播任何侵权软件与信息,部分资源为网友搜集或发布,仅供学习和研究使用,请支持正版。站内所发布的资源,如有侵犯你的权益,请联系我们,本站将立即改正或删除。

QQ|Archiver|手机版|小黑屋|联系我们|中华设计论坛 ( 苏ICP备20023187号-1

GMT+8, 2024-9-20 12:03

Powered by Discuz! X3.5

© 2006-2024 Daliang Team.

快速回复 返回顶部 返回列表