NX9+VS2012
#include <uf.h>
#include <uf_assem.h>
#include <uf_ui.h>
#include <uf_part.h>
UF_initialize();
//获得装配树根
tag_t RootTag = UF_ASSEM_ask_root_part_occ(UF_PART_ask_display_part());
//遍历根的子组件
tag_t* child_part_occs = NULL_TAG;
int part_num = UF_ASSEM_ask_part_occ_children(RootTag, &child_part_occs);
for (int i = 0; i < part_num; i++)
{
//partocc转instance
tag_t instanceTag = UF_ASSEM_ask_inst_of_part_occ(child_part_occs[i]);
uc1601("1",1);
//组件抑制
tag_t instances[] = { instanceTag };
int failures[] = { 0 };
UF_ASSEM_suppress_instances(1, instances, failures);
uc1601("2",1);
//取消组件抑制
int failures1[] = {0};
UF_ASSEM_unsuppress_instances(1,instances, failures1);
}
//释放
UF_free(child_part_occs);
UF_terminate();
Caesar卢尚宇
2020年9月19日