• OPENC函数 UF_CSYS UF_MTX UF_VEC (判断矢量平行)(UF_VEC3_is_parallel)


     1 //设置single_dialog选择过滤
     2 static int init_proc(UF_UI_selection_p_t select,void* user_data)
     3 {
     4     int num_triples = 1;
     5     //
     6     UF_UI_mask_t mask_triples[] = {UF_face_type,0,0};
     7     /* enable only lines and edges */
     8     if((UF_UI_set_sel_mask(select,UF_UI_SEL_MASK_CLEAR_AND_ENABLE_SPECIFIC,num_triples, mask_triples)) == 0)
     9     {
    10         return (UF_UI_SEL_SUCCESS);
    11     }
    12     else
    13     {
    14         return (UF_UI_SEL_FAILURE);
    15     }
    16 }
    17 extern DllExport void ufsta( char *param, int *returnCode, int rlen )
    18 {
    19     /* Initialize the API environment */
    20     if( UF_CALL(UF_initialize()) ) 
    21     {
    22         /* Failed to initialize */
    23         return;
    24     }
    25     
    26     /* TODO: Add your application code here */
    27     UF_initialize();
    28     //select_with_single_dialog
    29     char message[]="单选对话框";
    30     char title[]="请选择:";
    31     int scope=UF_UI_SEL_SCOPE_ANY_IN_ASSEMBLY;
    32     int response=0;
    33     int count=0;
    34     tag_t objects=NULL;
    35     double cursor[3]={0.0};
    36     tag_t vieew=NULL_TAG;
    37     //ask_face_data
    38     int  type=22;//有界平面
    39     double point[3]={0.0};
    40     double direction[3]={0.0};
    41     double bounding_box[6]={0.0};
    42     double radius[3]={0.0};
    43     double rad_data[3]={0.0};
    44     int norm_dir=0;
    45 
    46     //坐标系那一堆
    47     tag_t wcs_tag=NULL_TAG;
    48     tag_t matrix_tag=NULL_TAG;
    49     double matrix_value[9]={0.0};
    50     double wcs_vec_x[3]={0.0};
    51     double wcs_vec_y[3]={0.0};
    52     double wcs_vec_z[3]={0.0};
    53     double tolerance=0.00001;
    54     //is_parallel
    55     int x_parallel=0;
    56     int y_parallel=0;
    57     int z_parallel=0;
    58 
    59     //获取wcs坐标系然后得到他的矩阵
    60     UF_CSYS_ask_wcs(&wcs_tag);
    61     UF_CSYS_ask_matrix_of_object(wcs_tag,&matrix_tag);
    62     UF_CSYS_ask_matrix_values (matrix_tag,matrix_value);
    63     //得到x y z三个矢量方向
    64     UF_MTX3_x_vec(matrix_value,wcs_vec_x);
    65     UF_MTX3_y_vec(matrix_value,wcs_vec_y);
    66     UF_MTX3_z_vec(matrix_value,wcs_vec_z);
    67     //单选对话框
    68     UF_UI_select_with_single_dialog (message,title,scope,init_proc,NULL,&response,&objects,cursor,&vieew);
    69     if (response == UF_UI_OBJECT_SELECTED ||response == UF_UI_OBJECT_SELECTED_BY_NAME)
    70     {
    71         UF_DISP_set_highlight(objects,0);
    72         UF_MODL_ask_face_data(objects,&type,point,direction,bounding_box,radius,rad_data,&norm_dir);
    73         UF_VEC3_is_parallel (wcs_vec_x,direction,tolerance,&x_parallel);
    74         UF_VEC3_is_parallel (wcs_vec_y,direction,tolerance,&y_parallel);
    75         UF_VEC3_is_parallel (wcs_vec_z,direction,tolerance,&z_parallel);
    76         if (x_parallel==1)
    77         {
    78             uc1601("与WCS的X轴平行",1);
    79         }
    80         else if (y_parallel==1)
    81         {
    82             uc1601("与WCS的Y轴平行",1);
    83         }
    84         else if (z_parallel==1)
    85         {
    86             uc1601("与WCS的Z轴平行",1);
    87         }
    88         else 
    89         {
    90             uc1601("都不平行",1);
    91         }
    92     }
    93 
    94     UF_terminate();
    95     /* Terminate the API environment */
    96     UF_CALL(UF_terminate());
    97 }

  • 相关阅读:
    Java代码:response压缩响应
    SpringBoot框架:第一章:基础配置和介绍
    asp.net 发送email
    .NET环境下水晶报表使用总结
    ASP.net(c#)生成条形码
    表格操作类(添加,删除,排序,上移,下移)
    NET email
    C#如何打印条形码EAN13码
    在asp.net中备份还原SQL Server数据库
    配置SQL2000数据库发送邮件
  • 原文地址:https://www.cnblogs.com/zzyfym/p/12123160.html
Copyright © 2020-2023  润新知