NX二次开发 UFUN部件occ转实例instance UF_ASSEM_ask_inst_of_part_occ

NX二次开发 UFUN部件occ转实例instance UF_ASSEM_ask_inst_of_part_occ

//NX8.0+VS2010
#include 
#include 

extern DllExport void ufsta(char* param, int* returnCode, int rlen)
{
	if (UF_initialize())
		return;
	

    //获得装配树根
    tag_t root_tag = 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(root_tag, &child_part_occs);
    for (int i = 0; i < part_num; i++)
    {
        //partocc转instance
        tag_t instance_tag = UF_ASSEM_ask_inst_of_part_occ(child_part_occs[i]);

        uc1601("1", 1);

        //组件抑制
        tag_t instances[] = { instance_tag };
        int failures[] = { 0 };
        UF_ASSEM_suppress_instances(1, instances, failures);

        uc1601("2", 1);

        //取消组件抑制
        int failures1[] = { 0 };
        UF_ASSEM_unsuppress_instances(1, instances, failures1);
    }
    if (part_num > 0)
    {
        //释放
        UF_free(child_part_occs);
    }

	UF_terminate();
}

你可能感兴趣的:(2丶UFUN,c++,开源)