zoukankan      html  css  js  c++  java
  • NX CAM二次开发-UF_PARAM_set_tag_value设置操作的底面

    NX9+VS2012
    
    #include <uf.h>
    #include <uf_ui.h>
    #include <uf_modl.h>
    #include <uf_ui_ont.h>
    #include <uf_param.h>
    #include <uf_param_indices.h>
    #include <uf_object_types.h>
    #include <uf_obj.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);
    
        //获得面的原点和向量
        int Type;
        double Point[3];
        double Dir[3];
        double Box[6];
        double Radius[3];
        double RadData[3];
        int NormDir;
        UF_MODL_ask_face_data(faceTag, &Type, Point, Dir, Box, Radius, RadData, &NormDir);
    
        //创建基准平面
        tag_t plane_tag=NULL_TAG;
        UF_MODL_create_plane(Point, Dir, &plane_tag);
    
        //设置操作的底面
        UF_PARAM_set_tag_value(operTag, UF_PARAM_FLOOR, plane_tag);
    
        //隐藏
        UF_OBJ_set_blank_status(plane_tag, UF_OBJ_BLANKED);
    }
    
    //释放
    UF_free(objects);
    
    UF_terminate();
    
    Caesar卢尚宇
    2020年5月25日

    作者: 阿飞

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

    关于作者:......

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

  • 相关阅读:
    过河问题 贪心
    喷水装置2 贪心
    喷水装置 贪心算法
    大红数星星 图论 XD网络赛
    Bi-shoe and Phi-shoe 欧拉函数 素数
    c++ 打飞机游戏开发日志
    POJ 1129 Channel Allocation DFS 回溯
    POJ 2676 Sudoku
    LibreOJ #100. 矩阵乘法
    BZOJ 1009: [HNOI2008]GT考试
  • 原文地址:https://www.cnblogs.com/nxopen2018/p/12960757.html
Copyright © 2011-2022 走看看