UFUN函数 UF_TRNS(平移 变换)( uf5943 , uf5947)

 1 //设置class_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_solid_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 
18 extern DllExport void ufsta( char *param, int *returnCode, int rlen )
19 {
20     /* Initialize the API environment */
21     if( UF_CALL(UF_initialize()) ) 
22     {
23         /* Failed to initialize */
24         return;
25     }
26     
27     /* TODO: Add your application code here */
28     UF_initialize();
29 
30     //select_with_class_dialog
31     char message[]="类选择对话框";
32     char title[]="按类选择:";
33     int scope=UF_UI_SEL_SCOPE_ANY_IN_ASSEMBLY;
34     int response=0;
35     int count=0;
36     tag_t* objects=NULL;
37     //5943
38     double translation[3]={0.0,500.0,500.0};
39     double matrix_value[16]={0.0};
40     /*
41         绝对坐标系 的平移距离
42         translation[0] x向的距离
43         translation[1] y向的距离
44         translation[2] z向的距离
45     */
46     //5947
47     tag_t *objects_array=NULL;
48     int move_or_copy=2;//1 - Move  2 - copy
49     int dest_layer=0;//0 - the original layer,  -1 - the work layer,  1 - 256 - the specified layer
50     int trace_curves=2;//轨迹曲线状态1 means on, 2 means off.
51     tag_t *copies=NULL;//这是当move_or_copy等于1(移动)时不使用。当move_or_copy为2(副本)时,应设置一个为空tag_t
52     tag_t trace_curve_group=NULL;//当trace_curves=2时,此处设置为null
53     int status_value=0;
54     //多选对话框
55     UF_UI_select_with_class_dialog (message,title,scope,init_proc,NULL,&response,&count,&objects);
56     //分配内存
57     objects_array=(tag_t*)malloc(sizeof(tag_t)*count);
58     if (response == UF_UI_OK && count > 0)
59     {
60         for (int i=0; i<count; i++)
61         {
62             objects_array[i]=objects[i];
63             UF_DISP_set_highlight(objects[i], 0);
64         }
65 
66     }
67     //返回矩阵以执行线性变换,沿着  绝对坐标系  的X轴,Y轴和Z轴。
68     uf5943(translation,matrix_value);
69     //分配内存
70     copies=(tag_t*)malloc(sizeof(tag_t)*count);
71     //平移 
72     uf5947(matrix_value,objects_array,&count,&move_or_copy,&dest_layer,&trace_curves,copies,&trace_curve_group,&status_value);
73     //释放内存
74     free(copies);
75     free(objects_array);
76     /*
77     注意:
78     1.坐标系问题
79         注意平移变换 这个玩意是按  绝对坐标系 方向来的(坐标系不统一时先把坐标系统一)
80     2.注意内存的分配。
81     3.如果是有参数的体 经过 uf5947 平移变换后变成 去参后的体。
82 
83     4.trace_curves 轨迹曲线状态 ps:我也不明白是什么意思,求大神什么解释
84     */
85 
86     UF_terminate();
87 
88     /* Terminate the API environment */
89     UF_CALL(UF_terminate());
90 }

猜你喜欢

转载自www.cnblogs.com/zzyfym/p/12090675.html