点击查看详细介绍

NXOpen C++ 通过属性标题读取string属性值函数代码

nxopen 7年前 2965 6

购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008  QQ号:85585969  


//根据属性标题读取string属性值
string GetstringAtrrvalue(NXObject *obj, string atrrTitle)
{
string atrrvalue = "";
std::vector<NXObject::AttributeInformation> attributeInformations = obj->GetAttributeTitle *** yType(NXObject::AttributeType::AttributeTypeString);
for(int n=0; n<attributeInformations.size(); n++)
{
if(string(attributeInformations[n].Title.GetLocaleText()) == string(NXString(atrrTitle.c_str()).GetLocaleText()))
{
●●●请先 登陆注册 后查看●●●

}
}
return atrrvalue;

}


//函数使用方法
Assemblies::Component * component = NULL;
component = theSession->Parts()->Display()->ComponentAssembly()->RootComponent();
string strvalue = GetstringAtrrvalue(component, "零件名称")

//返回的值strvalue 就是总装配下属性名称为“零件名称”的属性值

2

最新回复 (6)
  • cheengbin 6年前
    1

    返回的值strvalue 就是总装配下属性名称为“零件名称”的属性值

  • jimk 6年前
    2

    学习一下,谢谢分享。。。

  • hua7766 5年前
    3

    感谢分享,正好可以用上

  • lione 5年前
    4

    foxlandy 1年前 20楼 谢谢分享,好好学习

  • 司徒星剑 4年前
    5

    学习一下,谢谢分享。。。

  • qqqking 4年前
    6

    谢谢分享,好好学习谢谢分享,好好学习

请登录后发表新帖