void twb_xd_std::set_attr( std::vector<NXOpen::NXObject *> objects , string attr_category, string attr_title , string attr_value )
{ NXOpen::Session *theSession = NXOpen::Session::GetSession(); NXOpen::Part *workPart(theSession->Parts()->Work()); NXOpen::Part *displayPart(theSession->Parts()->Display()); NXOpen::AttributePropertiesBuilder *attributePropertiesBuilder1; attributePropertiesBuilder1 = theSession->AttributeManager()->CreateAttributePropertiesBuilder(workPart, objects, NXOpen::AttributePropertiesBuilder::OperationTypeNone); //设置属性 attributePropertiesBuilder1->SetCategory(attr_category.c_str());//类别 attributePropertiesBuilder1->SetTitle(attr_title.c_str());//标题 attributePropertiesBuilder1->SetStringValue(attr_value.c_str());//值 attributePropertiesBuilder1->Commit();//执行 attributePropertiesBuilder1->Destroy();//销毁 }NXOPEN设置属性
2024-03-06 14:35:07