|
|
编程的时候对精加工经常要调整小公差,比如0.01,一个操作要点6次以上鼠标,比较繁琐,附件程序可一键修改,并重新生成刀路。
使用方法:
1.选择程序或者程序组,递归对选择组进行处理,如果是程序则 内外公差均改为0.01;
2.修改后重新生成刀路,避免手动调整
NX2306+VS2019验证通过:
核心代码:
void MyClass::do_it()
{
tag_t setup_tag = NULL_TAG;
UF_SETUP_ask_setup(&setup_tag);
if (setup_tag == NULL_TAG) {
uc1601("请先进入到加工环境",1);
return;
}
int count = 0;
tag_t* node_tag =NULL;
UF_UI_ONT_ask_selected_nodes(&count,&node_tag);
if (count == 0) {
uc1601("请选择操作节点", 1);
return;
}
for (int i = 0;i < count;i++) {
doOperCycle(node_tag);
}
UF_free(node_tag);
}
void MyClass::doOperCycle(tag_t node_tag) {
bool b = false;
UF_NCGROUP_is_group(node_tag, &b);
if (b) {
int n=0;
tag_t* operList=NULL;
UF_NCGROUP_ask_member_list(node_tag,&n,&operList);
for (int i = 0;i < n;i++) {
doOperCycle(operList);
}
UF_free(operList);
}
else {
int type = 0;
int sub_type = 0;
UF_OBJ_ask_type_and_subtype(node_tag,&type,&sub_type);
if (type==UF_machining_operation_type) {
double tol[2];
int ret = UF_PARAM_ask_2d_value(node_tag, UF_PARAM_TOL_IN_OUT, tol);
if (0 == ret) {
tol[0] = 0.01;
tol[1] = 0.01;
UF_PARAM_set_2d_value(node_tag, UF_PARAM_TOL_IN_OUT, tol);
bool b=false;
UF_PARAM_generate(node_tag,&b);
}
}
}
}
NXTolChange.rar
(13.44 KB, 下载次数: 3)
|
|