|
就是要用到自带JA去录制c++写属性的过程,用Assemblies::Component *component1=(Assemblies::Component *)NXObjectManager::Get(obj); 将tag_t obj转成实例化成open c++,就能将前录制的步骤连接起来了
I; u' j8 K( N7 r8 f! }4 @Assemblies::Component *component1=(Assemblies::Component *)NXObjectManager::Get(obj); * j& X3 z; w6 {
std::vector<NXObject *> objects1(1);
8 _' @! S) z$ t objects1[0] = component1;
# {5 ^7 |- L/ I3 p: ?% q6 T N AttributePropertiesBuilder *attributePropertiesBuilder1;8 L: d. {( S9 H& q4 Z4 e
attributePropertiesBuilder1 = workPart->PropertiesManager()->CreateAttributePropertiesBuilder(objects1);2 I% h0 M3 f: |8 t. Z! m' K+ J
attributePropertiesBuilder1->SetObjectPicker(AttributePropertiesBaseBuilder::ObjectOptionsComponentInstance);//写入组件
0 T, A; T/ e x# C+ r1 W) v* f//attributePropertiesBuilder1->SetObjectPicker(AttributePropertiesBaseBuilder::ObjectOptionsComponentAsPartAttribute); //写入部件中
" Y& L, t9 Q4 y8 a/ ]8 H //attributePropertiesBuilder1->SetObjectPicker(AttributePropertiesBaseBuilder::ObjectOptionsOccurrence);//写入装配
2 I. \' V$ h. ]- Y8 c; M0 W//下面进行属性值填写& ]) p; t3 V* [* r; C
attributePropertiesBuilder1->SetTitle(“你的标题”);
, w3 w6 `$ A J! B+ X/ U attributePropertiesBuilder1->SetStringValue("你的属性值");% }, Q& J0 t% a
NXObject *nXObject2;" U, `' |0 q1 X
nXObject2 = attributePropertiesBuilder1->Commit();8 p7 e6 g2 _6 S2 [% x; g. q, T
attributePropertiesBuilder1->Destroy(); |
|