OPNEC函数 UF_bound创建边界的信息(UF_BOUND_ask_boundary_data)

 1 void printf_msg(tag_t bound_tag)
 2 {
 3     tag_t boundary_tag=bound_tag;
 4     UF_BOUND_all_data_t boundary_data;
 5     UF_BOUND_ask_boundary_data (boundary_tag,&boundary_data);
 6     /*
 7     boundary_data.num_members;//边界的个数
 8     boundary_data.open_closed_flag;//边界是打开还是封闭的 UF_BOUND_OPEN=1 or UF_BOUND_CLOSED=0
 9     boundary_data.plane_matrix;//平面矩阵的tag值
10     boundary_data.minimum_distance;//边界到平面的最小距离
11     boundary_data.maxmin_box[4];//边界的最小值和最大值(类似最小包容体那个  但是这个是二维的最小的x,y值和最大的x,y值)
12     boundary_data.tolerance[2];    //边界公差
13                                 //公差[0]:允许的最大值边界可能的公差偏离定义弯成零件
14                                 //公差[1]:允许的最大值边界可能的公差偏离定义远离零件弯曲        
15     boundary_data.members_data->member_tag;//直线的tag值
16     boundary_data.members_data->on_tangent_to_flag;//刀具切还是on  UF_BOUND_ON=0 or UF_BOUND_TANGENT_TO=1.
17     boundary_data.members_data->contiguity_flag;//成链 UF_BOUND_CONTIGUOUS=1 or UF_BOUND_NOT_CONTIGUOUS=0
18     boundary_data.members_data->parameter_range[2];//参数范围
19     boundary_data.members_data->midpoint[2];//中点
20     boundary_data.members_data->direction_vec[2];//二维方向向量
21     */
22     char msg_num_numbers[256],msg_open_closed_flag[256],msg_plane_matrix[256],msg_minimum_distance[256],
23     msg_maxmin_box[256],msg_tolerance[256],msg_member_tag[256],msg_on_tangent_to_flag[256],msg_contiguity_flag[256],
24     msg_parameter_range[256],msg_midpoint[256],msg_direction_vec[256];
25 
26     sprintf_s(msg_num_numbers,"边界的个数=%d\n",boundary_data.num_members);
27     sprintf_s(msg_open_closed_flag,"边界打开还是封闭=%d\n",boundary_data.open_closed_flag);
28     sprintf_s(msg_plane_matrix,"平面矩阵的tag=%d\n",boundary_data.plane_matrix);
29     sprintf_s(msg_minimum_distance,"边界到平面的最小距离=%f\n",boundary_data.minimum_distance);
30     sprintf_s(msg_maxmin_box,"边界最大和最小=%f,%f,%f,%f\n",boundary_data.maxmin_box[0],boundary_data.maxmin_box[1],boundary_data.maxmin_box[2],boundary_data.maxmin_box[3]);
31     sprintf_s(msg_tolerance,"边界公差=%f\n",boundary_data.tolerance[0],boundary_data.tolerance[1]);
32 
33     sprintf_s(msg_member_tag,"直线的tag=%d\n",boundary_data.members_data->member_tag);
34     sprintf_s(msg_on_tangent_to_flag,"边界切还是on=%d\n",boundary_data.members_data->on_tangent_to_flag);
35     sprintf_s(msg_contiguity_flag,"是否成链=%d\n",boundary_data.members_data->contiguity_flag);
36     sprintf_s(msg_parameter_range,"参数范围=%f,%f\n",boundary_data.members_data->parameter_range[0],boundary_data.members_data->parameter_range[1]);
37     sprintf_s(msg_midpoint,"中点=%f,%f\n",boundary_data.members_data->midpoint[0],boundary_data.members_data->midpoint[1]);
38     sprintf_s(msg_direction_vec,"矢量方向=%f,%f\n",boundary_data.members_data->direction_vec[0],boundary_data.members_data->direction_vec[1]);
39 
40     //打印
41     UF_UI_open_listing_window();
42     UF_UI_write_listing_window(msg_num_numbers);
43     UF_UI_write_listing_window(msg_open_closed_flag);
44     UF_UI_write_listing_window(msg_plane_matrix);
45     UF_UI_write_listing_window(msg_minimum_distance);
46     UF_UI_write_listing_window(msg_maxmin_box);
47     UF_UI_write_listing_window(msg_tolerance);
48     UF_UI_write_listing_window(msg_member_tag);
49     UF_UI_write_listing_window(msg_on_tangent_to_flag);
50     UF_UI_write_listing_window(msg_contiguity_flag);
51     UF_UI_write_listing_window(msg_parameter_range);
52     UF_UI_write_listing_window(msg_midpoint);
53     UF_UI_write_listing_window(msg_direction_vec);
54     UF_UI_write_listing_window("\n");
55     UF_UI_write_listing_window("\n");
56 
57     //释放内存
58     UF_free(boundary_data.members_data);
59 }
60 extern DllExport void ufsta( char *param, int *returnCode, int rlen )
61 {
62     /* Initialize the API environment */
63     if( UF_CALL(UF_initialize()) ) 
64     {
65         /* Failed to initialize */
66         return;
67     }
68     
69     /* TODO: Add your application code here */
70     UF_initialize();
71     //直来直去的四线
72     printf_msg(52486);
73     printf_msg(52481);
74     printf_msg(52491);
75     printf_msg(52541);
76     //斜着的四线
77     printf_msg(52538);
78     printf_msg(52533);
79     printf_msg(52510);
80     printf_msg(52501);
81     //边界z为100的线
82     printf_msg(81344);
83 
84     UF_terminate();
85 
86     UF_CALL(UF_terminate());
87 }
/*
  1.有机会自己可以做个 边界成链 的看看,边界的个数就会显示多个 而不是一个。
  返回的线的tag应该就不是一个了 我没有打印。
  2.UF_BOUND_create_boundary 这个玩意官方有源码 但是我测试了一下 boundry并没有出现
  不知道为什么

*/

posted @ 2020-01-09 13:57  你好我叫赵老师  阅读(698)  评论(0编辑  收藏  举报