• 本来做个选面创建9个坐标的.结果搞了个选面包容体


    
    
     1 static int select_filter_proc_fn(tag_t object, int type[1], void* user_data, UF_UI_selection_p_t select)
     2 {
     3 
     4     if (object == NULL)
     5         return UF_UI_SEL_REJECT;
     6     else if (object)   //&& Type== UF_line_type&&subtype== UF_line_normal_subtype)    //&&edge_count == 2 && Type == UF_cone_subtype    
     7         return UF_UI_SEL_ACCEPT;
     8 
     9 }
    10 
    11 
    12 static int init_face(UF_UI_selection_p_t select, void *user_data)
    13 {
    14     int  errorCode = 0;
    15     int  num_triples = 1;
    16     UF_UI_mask_t mask_triples[] = { UF_solid_type,UF_solid_face_subtype, UF_UI_SEL_FEATURE_PLANAR_FACE };
    17     errorCode = UF_UI_set_sel_mask(select, UF_UI_SEL_MASK_CLEAR_AND_ENABLE_SPECIFIC, num_triples, mask_triples);
    18     if (errorCode == 0)
    19     {
    20         return UF_UI_SEL_SUCCESS;
    21     }
    22     else
    23     {
    24         return UF_UI_SEL_FAILURE;
    25     }
    26 }
    
    
    
     1 UF_initialize();
     2     tag_t workCsys = NULL_TAG;
     3     tag_t mtxWcs = NULL_TAG;
     4     double orginWcs[3];
     5     UF_CSYS_ask_wcs(&workCsys);
     6     UF_CSYS_ask_csys_info(workCsys, &mtxWcs, orginWcs);
     7 
     8     char         sCue[]        = "选择";
     9     char         sTitle[]        = "功能测试";
    10     int             iScope    = UF_UI_SEL_SCOPE_NO_CHANGE;
    11     int             iResponse;
    12     tag_t     tObject;
    13     tag_t     bodyTag = NULL_TAG;
    14     tag_t    wcsTag = NULL_TAG;
    15     tag_t    viewTag = NULL_TAG;
    16 
    17     double  cursor[3];
    18     double min_corner[3];
    19     double directions[3][3];
    20     double distances[3];
    21     UF_UI_select_with_single_dialog(sCue, sTitle, iScope, init_face, NULL, &iResponse,  &tObject,cursor,&viewTag);
    22     UF_MODL_ask_face_body(tObject, &bodyTag);
    23 
    24     double param[2] = { 0.5,0.5 };       //输入U,V方向值
    25     double poin[3];     //输出点坐标
    26     double u1[3];        //输出 输出一阶导数在U位置
    27     double v1[3];        //输出 输出一阶导数在V位置
    28     double u2[3];        //输出 输出二阶导数在U位置
    29     double v2[3];        //输出 输出二阶导数在V位置
    30     double unit_norm[3]; //输出面上该点的矢量方向--------输出矢量方向★
    31     double radii[2];     //输出,双半径,输出主曲率半径
    32     UF_MODL_ask_face_props(tObject, param, poin, u1, v1, u2, v2, unit_norm, radii);
    33     double mtxa[9];
    34     double ax[3], ay[3], az[3];
    35     tag_t mtxID = NULL_TAG;
    36     tag_t csysID = NULL_TAG;
    37     UF_MTX3_initialize(u1, v1, mtxa);
    38     UF_CSYS_create_matrix(mtxa, &mtxID);
    39     UF_CSYS_create_temp_csys(poin, mtxID, &csysID);
    40     UF_CSYS_set_wcs(csysID);
    41     UF_CSYS_ask_wcs(&wcsTag);
    42     UF_MODL_ask_bounding_box_exact(bodyTag, wcsTag, min_corner, directions, distances);
    43 
    44     tag_t matrixTag = NULL_TAG;
    45     tag_t blcokTag = NULL_TAG;
    46     tag_t bodyblockTag = NULL_TAG;
    47     double matrix3x3[9] = {
    48                                     directions[0][0],    directions[0][1],    directions[0][2],
    49                                     directions[1][0],    directions[1][1],    directions[1][2],
    50                                     directions[2][0],    directions[2][1],    directions[2][2]
    51     };
    52     UF_CSYS_create_matrix(matrix3x3, &matrixTag);
    53     char L[256], W[256],H[256];
    54     sprintf(L, "%f", distances[0]);
    55     sprintf(W, "%f", distances[1]);
    56     sprintf(H, "%f", distances[2]);
    57     char* blockLen[3] = { L,W,H };
    58     UF_MODL_create_block1(UF_NULLSIGN, min_corner, blockLen, &blcokTag);
    59     UF_MODL_ask_feat_body(blcokTag, &bodyblockTag);
    60     UF_OBJ_set_color(bodyblockTag, 36);
    61     UF_OBJ_set_translucency(bodyblockTag, 60);
    62     temp_obj.push_back(bodyblockTag);
    63 
    64     tag_t tempWcs = NULL_TAG;
    65     UF_CSYS_create_temp_csys(orginWcs, mtxWcs, &tempWcs);
    66     UF_DISP_set_highlight(tObject, 0);
    67 
    68 
    69     UF_terminate();

  • 相关阅读:
    PHP读写XML文件的四种方法
    如何在linux系统中设置静态ip地址
    Memcached和Memcache安装(64位win7)
    Mysql存储过程和函数区别介绍
    随笔
    Vue 中使用axios传参数,后端收不到数据
    vs2019创建mvc连接mysql
    dapper多表查询
    Java并发编程:volatile关键字解析
    Mysql Innodb 间隙锁浅析
  • 原文地址:https://www.cnblogs.com/liuxiaoqing1/p/12852483.html
Copyright © 2020-2023  润新知