【NX二次开发】缝合片体例子UF_MODL_create_sew
缝合片体,没有成功缝合的片体涂绿色。
效果:
源码:
extern DllExport void ufusr(char *param, int *returnCode, int rlen) { UF_initialize(); uc1601("缝合", 1); //体的 tag(注意不是特征的tag) tag_t tagFace1 = 44632; tag_t tagFace2 = 45120; tag_t tagFace3 = 46400; tag_t tagFace4 = 47071;//未接触缝不上 tag_t tagFace5 = 47039;//未接触缝不上 int option = 0; int num_targets = 1; tag_t targets[1] = { tagFace1 }; int num_tools = 4; tag_t tools[4] = { tagFace2,tagFace3,tagFace4,tagFace5 }; double tolerance = 0.001; int type_body = 0; uf_list_t *disjoint_list; tag_t sew_id = 0; UF_MODL_create_sew(option, num_targets, targets, num_tools, tools, tolerance, type_body, &disjoint_list, &sew_id); int count = 0; UF_MODL_ask_list_count(disjoint_list, &count); for (int i = 0; i < count; i++) { tag_t tagFace = NULL_TAG; UF_MODL_ask_list_item(disjoint_list, i, &tagFace); UF_OBJ_set_color(tagFace, 2); //涂绿色36 } UF_free(disjoint_list); disjoint_list = NULL; UF_terminate(); } extern int ufusr_ask_unload(void) { return (UF_UNLOAD_IMMEDIATELY); }