iCAx开思工具箱

标题: CAA中怎么创建文字标注?(acoka和nctusdk两位帮忙看看吧) [打印本页]

作者: cupcake    时间: 2005-5-12 22:23
标题: CAA中怎么创建文字标注?(acoka和nctusdk两位帮忙看看吧)
各给高手:
       怎么在图上标注文本,如图,怎么用程序实现?请指点。
作者: acoka    时间: 2005-5-13 09:49
CATITPSFactoryAdvanced->CreateTextOnAnnotation()
作者: cupcake    时间: 2005-5-13 10:56
谢谢高手
:)
作者: cupcake    时间: 2005-5-27 16:05
acoka兄,我把例子里面的代码改了,可是有错:
例子里面代码如下:
boolean CAATpiCreateTextCmd::CreateTextOnSelection (void * ipData)
{
  
  
  // Retrieve the selected geometry
  CATSO * pSelection = _pAgentGeometry ->GetListOfValues();
  
  if ( pSelection )
  {
    // Retrieve CATITPSFactoryAdvanced interfaces
    CATITPSFactoryAdvanced * piFactAdv = NULL;
    HRESULT rc = CATTPSInstantiateComponent (DfTPS_ItfTPSFactoryAdvanced,
                                     (void**) [$ piFactAdv)]
    if ( SUCCEEDED(rc) )
    {
      CATITPSText * piText = NULL;
      CATUnicodeString TextString("Sample 3D Text");
      CATMathPlane Plane = CATMathOIJ;
      rc = piFactAdv -> CreateTextOnGeometry (pSelection, &lane,
                                              [$TextString , &piText)]
……
由于我要在自己生成的点上作标注,所以就像你说的,new了一个CATSO*,代码如下:
boolean ChildCmd1::CreateTextOnGeometry(CATISpecObject_var spPointAsSpec)
{
  
  cout<<cout<<"CreateTextOnGeometry called !!!"<<endl;
  
  // Retrieve the selected geometry
  
    CATBaseUnknown* pPointAsBaseUnknown = spPointAsSpec;
  
  CATSO * pSelection = new CATSO(0);
  pSelection->AddElement(pPointAsBaseUnknown,0);
  if ( pSelection==NULL ) cout<<endl<<cout<<"pSelection==NULL"<<endl;
   if ( pSelection!=NULL )
  {
    // Retrieve CATITPSFactoryAdvanced interfaces
    CATITPSFactoryAdvanced * piFactAdv = NULL;
     HRESULT rc =CATTPSInstantiateComponent (DfTPS_ItfTPSFactoryAdvanced,
                                    (void**) [$ piFactAdv)]
   if ( SUCCEEDED(rc) )
    {
     cout<<endl<<cout<<"piFactAdv!=NULL"<<endl;
      CATITPSText * piText = NULL;
      CATUnicodeString TextString("Sample 3D Text");
      CATMathPlane Plane = CATMathOIJ;
      rc = piFactAdv -> CreateTextOnGeometry (pSelection, NULL,
                                            [$TextString , &piText)]
……
可是到这句CATIA就退出了:
  rc = piFactAdv -> CreateTextOnGeometry (pSelection, NULL,
                                            [$TextString , &piText)]
  
请问怎么解决呢?
作者: cupcake    时间: 2005-5-29 13:06
求助
作者: cupcake    时间: 2005-6-1 14:02
麻烦高手再看看了
:)
作者: cupcake    时间: 2005-6-2 15:06
什么原因呢,高手来看看啊
作者: acoka    时间: 2005-6-2 21:09
不知道,如果你方便可以把workspace给公开,让大家提你debug一下
因为问题不一定就只在这段代码里
作者: cupcake    时间: 2005-6-16 11:12
高手们再看看吧
作者: cupcake    时间: 2005-6-16 11:33
不知道CATITPSFactoryElementary的
  CreateText(CATITTRS*,CATITPSText**) 函数可不可以达到我的要求?
作者: cupcake    时间: 2005-6-16 11:40
就是想实现这个工具条上的命令的功能(如图)




欢迎光临 iCAx开思工具箱 (https://t.icax.org/) Powered by Discuz! X3.3