• NX CAM二次开发-UF_CAMBND_append_bnd_from_face设置面铣操作的面边界


    NX9+VS2012
    
    #include <uf.h>
    #include <uf_ui.h>
    #include <uf_modl.h>
    #include <uf_ui_ont.h>
    #include <uf_cambnd.h>
    #include <uf_object_types.h>
    
    
    
    static int select_filter_proc_fn(tag_t object, int type[3], void* user_data, UF_UI_selection_p_t select)
    {
        if (object == NULL)
        {
            return UF_UI_SEL_REJECT;
        }
        else
        {
            return UF_UI_SEL_ACCEPT;
        }
    }
    
    static int init_proc(UF_UI_selection_p_t select, void* user_data)
    {
        int num_triples = 1;//可选类型的数量
        UF_UI_mask_t mask_triples[] = 
        {UF_solid_type, UF_all_subtype, UF_UI_SEL_FEATURE_PLANAR_FACE};//可选对象类型
        UF_UI_set_sel_mask(select, UF_UI_SEL_MASK_CLEAR_AND_ENABLE_SPECIFIC, num_triples, mask_triples);
        if ((UF_UI_set_sel_procs(select, select_filter_proc_fn, NULL, user_data)) == 0)
        {
            return UF_UI_SEL_SUCCESS;
        }
        else
        {
            return UF_UI_SEL_FAILURE;
        }
    }
    
    
    UF_initialize();
    
    //获取当前加工导航器选中的对象数量和TAG
    int count = 0;
    tag_t* objects = NULL_TAG;
    UF_UI_ONT_ask_selected_nodes(&count, &objects);
    
    for (int i = 0; i < count; i++)
    {
        tag_t operTag = objects[i];
    
        //单对象选择对话框
        char sCue[] = "单对象选择对话框";
        char sTitle[] = "单对象选择对话框";
        int iScope = UF_UI_SEL_SCOPE_NO_CHANGE;
        int iResponse;
        tag_t faceTag = NULL_TAG;
        tag_t tView = NULL_TAG;
        double adCursor[3];
        UF_UI_select_with_single_dialog(sCue, sTitle, iScope, init_proc, NULL, &iResponse, &faceTag, adCursor, &tView);
    
        //设置面铣操作的面边界
        UF_CAMBND_boundary_data_t boundary_data;
        boundary_data.boundary_type=UF_CAM_boundary_type_closed;
        boundary_data.plane_type=1;
        boundary_data.origin[0]=0;
        boundary_data.origin[1]=0;
        boundary_data.origin[2]=0;
        boundary_data.matrix[0]=1;
        boundary_data.matrix[1]=0;
        boundary_data.matrix[2]=0;
        boundary_data.matrix[3]=0;
        boundary_data.matrix[4]=1;
        boundary_data.matrix[5]=0;
        boundary_data.matrix[6]=0;
        boundary_data.matrix[7]=0;
        boundary_data.matrix[8]=1;
        boundary_data.material_side=UF_CAM_material_side_in_left;
        boundary_data.ignore_holes=0;
        boundary_data.ignore_islands=0;
        boundary_data.ignore_chamfers=0;
        boundary_data.app_data=NULL;
        UF_CAMBND_append_bnd_from_face(operTag, UF_CAM_blank, faceTag, &boundary_data);
    
    }
    
    //释放
    UF_free(objects);
    
    UF_terminate();
    
    Caesar卢尚宇
    2020年5月25日

    作者: 阿飞

    出处: https://www.cnblogs.com/nxopen2018/>

    关于作者:......

    如有问题, 可在底部(留言)咨询.

  • 相关阅读:
    R语言实战学习总结
    R语言学习笔记(十七):高级绘图ggplot2
    R语言学习笔记(十六):处理缺失值
    R语言学习笔记(十五):分类
    R语言学习笔记(十四):聚类分析
    R语言学习笔记(十三):时间序列
    R语言学习笔记(十二):主成分分析和因子分析
    转:网页不应该出现的特殊字符
    转:html常用网页特殊字符代码大全,值得收藏!
    转:LoadRunner 12 安装教程
  • 原文地址:https://www.cnblogs.com/nxopen2018/p/12961304.html
Copyright © 2020-2023  润新知