iCAx开思工具箱

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 24645|回复: 2
打印 上一主题 下一主题

如何使用CATIMechanicalRootFactory创建特征!

[复制链接]
跳转到指定楼层
楼主
发表于 2010-3-16 14:47:37 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册登录,享用更多网站功能!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
HRESULT rc;
   
CATFrmEditor * pEditor   = GetEditor();
if (NULL == pEditor)
{
  return;
}
   
CATDocument *pDoc = pEditor->GetDocument();
if (NULL == pDoc)
{
  return;
}
   
CATInit *spInitOnDoc = NULL;
rc = pDoc -> QueryInterface (IID_CATInit, (void**) &spInitOnDoc);
if (E_NOINTERFACE == rc)
{
  Notify("NoCATInit");
  return;
}
CATIPrtContainer *pIPrtCont = NULL ;
pIPrtCont = (CATIPrtContainer*)
  spInitOnDoc->GetRootContainer("CATIPrtContainer");
if (NULL == pIPrtCont )
{
  return;
}
  CATISpecObject_var spSpecObjectOnPart = pIPrtCont->GetPart();
if (NULL_var == spSpecObjectOnPart)
{
  return;
}

CATIMechanicalRootFactory *pIMechanicalRootFactoryOnPart = NULL ;
rc = spSpecObjectOnPart->QueryInterface(IID_CATIMechanicalRootFactory,
  (void**)&pIMechanicalRootFactoryOnPart);
if (SUCCEEDED(rc ))
{
  Notify("SUCCEEDED");
}
else if (E_FAIL == rc )
{
  Notify("E_FAIL == tc");
  return;
}
else if(E_NOINTERFACE == rc )
{
  Notify("E_NOINTERFACE == rc ");
  return;
}

在创建一个新的MechanicalTool Feature或者是Geometrical Set时,要用到CATIMechanicalRootFactory 接口,但按照上面的代码,总显示接口不存在!不知是什么原因,但可以通过CATIDesendants获得MechanicalPart下面的特征!
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 支持支持
沙发
发表于 2010-3-22 10:18:59 | 只看该作者

马上注册登录,享用更多网站功能!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
板凳
 楼主| 发表于 2010-3-22 15:49:41 | 只看该作者

马上注册登录,享用更多网站功能!

您需要 登录 才可以下载或查看,没有帐号?立即注册

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

本版积分规则

手板模型制作,在线3D打印服务

QQ|小黑屋|手机版|开思工具箱 CAD工具箱_CAM工具箱  

GMT+8, 2024-10-1 08:21 , Processed in 0.011418 second(s), 8 queries , Gzip On, Redis On.

Powered by Discuz! X3.3

© 2002-2024 www.iCAx.org

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