iCAx开思工具箱

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 28161|回复: 10
打印 上一主题 下一主题

CAA怎样实现这个命令怎样改Annotation的批注线的长度和角度?

[复制链接]
跳转到指定楼层
楼主
发表于 2005-9-1 17:29:34 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
各位高手:  
boolean MyCmd1CmdreateTextOnGeometry(CATISpecObject_var spPointAsSpec,CATMathPlane Plane,double M)  
{  
   
  // Retrieve the selected geometry  
  HRESULT rc = S_OK;  
  CATPathElement* pPathElement = NULL;  
  do {  
    if( !spPointAsSpec )  
    {  
      break;  
    }  
    CATIBuildPath* pBuildPath = NULL;  
    {  
      rc = spPointAsSpec->QueryInterface(IID_CATIBuildPath,(void**)[$pBuildPath)]  
      if(FAILED(rc))  
      {  
        break;  
      }  
    }  
    CATPathElement activePath = CATFrmEditor::GetCurrentEditor()->GetUIActiveObject();  
    rc = pBuildPath->ExtractPathElement([$activePath,&pPathElement)]  
    {  
      if(!!pBuildPath)  
      {  
        pBuildPath->Release();  
        pBuildPath = NULL;  
      }  
      if(FAILED(rc) || !pPathElement)  
      {  
        break;  
      }  
    }  
    } while(0);  
  if ( !pPathElement )  
  {  
    return FALSE;  
  }  
  
  CATSO * pSelection = new CATSO(0);  
  pSelection->AddElement(pPathElement,0);  
if ( pSelection )  
  {  
    // Retrieve CATITPSFactoryAdvanced interfaces  
    CATITPSFactoryAdvanced * piFactAdv = NULL;  
    HRESULT rc =CATTPSInstantiateComponent (DfTPS_ItfTPSFactoryAdvanced,  
                                    (void**) [$ piFactAdv)]  
  
   if ( SUCCEEDED(rc) && !!piFactAdv)  
    {  
      CATITPSText * piText = NULL;  
   CATUnicodeString TextString;  
   TextString.BuildFromNum(M,"%g");  
  
      rc = piFactAdv ->CreateTextOnGeometry (pSelection, &lane,  
                                              [$TextString , &piText)]  
      if ( SUCCEEDED(rc) )  
      {  
        // Modifying Text Position  
        CATIDrwAnnotation * piAnnot = NULL;  
        rc = piText -> QueryInterface (IID_CATIDrwAnnotation,  
                                       (void**) [$ piAnnot)]  
        if ( SUCCEEDED(rc) )  
        {  
          double DeltaX = -1;  
          double DeltaY = +1;  
          piAnnot->Move(DeltaX, DeltaY);  
     piAnnot->SetOrientation(90/CATRadianToDegree);  
          piAnnot ->Release();  
          piAnnot = NULL;  
        }  
  
        // Modifying Text Size And Font  
        CATIDrwTextProperties * piTxtProp = NULL;  
        rc = piText -> QueryInterface (IID_CATIDrwTextProperties,  
                                          (void**) [$ piTxtProp)]  
        if ( SUCCEEDED(rc) )  
        {  
          // Change Font Size to 1.5 millimeters  
          piTxtProp -> SetFontSize (3);  
     piTxtProp ->SetMirroring(CATDrwFlipVertical);  
  
          piTxtProp -> Release();  
          piTxtProp = NULL;  
        }  
  
        // Use CATIDrwTextProperties::Refresh for updating visualization  
        // after leader and text modification  
        rc = piText -> QueryInterface (IID_CATIDrwTextProperties,  
                                       (void**) [$ piTxtProp)]  
        if ( SUCCEEDED(rc) )  
        {  
          piTxtProp -> Refresh();  
          piTxtProp -> Release();  
          piTxtProp = NULL;  
        }  
  
      
        piText -> Release();  
        piText = NULL;  
      }  
      piFactAdv -> Release();  
      piFactAdv = NULL;  
    }  
  }  
   
  return (TRUE);  
}  
  
以上代码完成3D批注,但是批注线的方向和批注线的长度不满足我的要求,请问怎样把批注线的长度减小,角度与所要标注的直线垂直?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 支持支持
沙发
发表于 2005-9-2 10:38:45 | 只看该作者

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

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

x
板凳
发表于 2005-9-2 12:53:57 | 只看该作者

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

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

x
地板
 楼主| 发表于 2005-9-3 09:50:51 | 只看该作者

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

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

x
5
 楼主| 发表于 2005-9-3 15:25:27 | 只看该作者

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

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

x
6
 楼主| 发表于 2005-9-6 23:25:41 | 只看该作者

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

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

x
7
 楼主| 发表于 2005-9-6 23:27:26 | 只看该作者

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

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

x
8
 楼主| 发表于 2005-9-6 23:29:27 | 只看该作者

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

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

x
9
发表于 2005-9-7 14:38:30 | 只看该作者

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

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

x
10
 楼主| 发表于 2005-9-22 23:05:31 | 只看该作者

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

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

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

本版积分规则

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

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

GMT+8, 2024-6-2 13:33 , Processed in 0.018998 second(s), 17 queries , Gzip On, Redis On.

Powered by Discuz! X3.3

© 2002-2024 www.iCAx.org

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