iCAx开思工具箱

标题: CAA中怎样得到特征的类型? [打印本页]

作者: cupcake    时间: 2005-3-18 14:47
标题: CAA中怎样得到特征的类型?
各位高手:
      我用了如下代码想要得到CATPart文件中的Body和OpenBody下的所有特征的类型(或者其主接口):
         int iChild=1 ;     
int nbchild = pIDescendants->GetNumberOfChildren() ;
while (  (FALSE == found) && (iChild <= nbchild) )
{
CATISpecObject_var spSpec1=pIDescendants->GetChildAtPosition(iChild);
                  CATUnicodeString  type=spSpec1->GetType();
  cout<<"***********************"<<endl;
  cout<<"The type is  "<<type.ConvertToChar()<<endl;
可是返回的却是这样的(图1),我想得到图2中的所有特征的类型,比如对于Rib特征,得到的类型为Rib或者得到CTAIRib,对于曲线3,得到CATCurve,请问有没有办法做到?
作者: cupcake    时间: 2005-3-18 14:57
图2
作者: hick    时间: 2005-3-18 15:10
你试试这个,没测试过:
  
CATIDescendants_var hDescendant(hPart);  CATListValCATISpecObject_var  hElementlist;  
  hDescendant->GetAllChildren(CATISpecObject::ClassName(), Elementlist);
...  
int Taille_ElementList = hElementlist.Size() ;
for (int i=1; i<=Taille_ElementList ; i++)  
{    CATBaseUnknown * ptInternalPtr = NULL;   
      CATIAlias_var hAlias ( hElementlist);  
      ...      
      hElementlist->QueryInterface (iIID, (void**)[$ ptInternalPtr)]     
      . ..        
     if (hAlias->GetAlias() == InstanceName)         
     {         
          RC = ptInternalPtr->QueryInterface(CATBaseUnknown::ClassId(),  (void**)[$ oEntity)]         
         if(SUCCEEDED(RC) && oEntity)         
        {
作者: hick    时间: 2005-3-18 15:12
hDescendant->GetAllChildren(CATISpecObject::ClassName(), Elementlist);  
RC = ptInternalPtr->QueryInterface(CATBaseUnknown::ClassId(), (void**)[$ oEntity)]
作者: cupcake    时间: 2005-3-18 16:19
谢谢hick兄,我去试试看。
:)




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