美文网首页狮猿社CATIA
CATIA caa获取文档的属性

CATIA caa获取文档的属性

作者: 锦囊喵 | 来源:发表于2020-01-19 11:17 被阅读0次

    原文链接

      //----------------------------------------------------------------------
        // 4-dump Attributes
        //----------------------------------------------------------------------    
        CATIAttributesDescription *piAttrDesc = NULL;
        rc = spRootProduct->QueryInterface(IID_CATIAttributesDescription, (void **) &piAttrDesc);
        if (FAILED(rc) || (NULL == piAttrDesc))
        {
            cout << "QueryInterface CATIAttributesDescription error" << endl;
            return 4;
        }
        CATIInstance *piInstance = NULL;
        rc = spRootProduct->QueryInterface(IID_CATIInstance, (void **) &piInstance);
        if (FAILED(rc) || (NULL == piInstance))
        {
            cout << "QueryInterface CATIInstance error" << endl;
            return 4;
        }
        CATListValCATAttributeInfos attrInfoList; 
        piAttrDesc->List(&attrInfoList);
        for (int i = 1; i <= attrInfoList.Size(); i++)
        {
            CATAttributeInfos attrInfo = attrInfoList[i];
            const CATUnicodeString& propertyName = attrInfo.Name(); //属性名
            const CATUnicodeString& valueType = attrInfo.Type()->Name(); //属性类型
            CATIValue *pValue = piInstance->GetValue(propertyName); //获得对应属性名的属性值
            CATUnicodeString value = "";
            pValue->AsString(value);
            cout << propertyName << "-" << valueType << "-" << value << endl;
            if (pValue)
            {
                pValue->Release();
                pValue = NULL;
            }
        }
    

    相关文章

      网友评论

        本文标题:CATIA caa获取文档的属性

        本文链接:https://www.haomeiwen.com/subject/cmlrzctx.html