UF_EVAL_is_arc 判断是圆形曲线或边,必须是正圆
UF_EVAL_ask_arc 圆形曲线或边分析,得到曲线或边的信息
类似的函数还有以下这些:
UF_EVAL_is_ellipse // 椭圆
UF_EVAL_ask_ellipse
UF_EVAL_is_hyperbola //双曲线
UF_EVAL_ask_hyperbola
UF_EVAL_is_line //直线
UF_EVAL_ask_line
UF_EVAL_is_parabola //抛物线
UF_EVAL_ask_parabola
UF_EVAL_is_spline //样条曲线
UF_EVAL_ask_spline
下面以UF_EVAL_ask_arc 为例:
1 #include "Text.h"
2 static int init_proc_select_edges(UF_UI_selection_p_t select, void *user_data)
3 {
4 int errorCode = 0;
5 //只是选择面
6 int num_triples = 1; //选择类型 数量
7 UF_UI_mask_t mask_triples[] = { UF_solid_type,UF_solid_edge_subtype,1 }; //定义选择类型
8
9 errorCode = UF_UI_set_sel_mask(select, UF_UI_SEL_MASK_CLEAR_AND_ENABLE_SPECIFIC, num_triples, mask_triples);
10 if (errorCode == 0)
11 {
12 return UF_UI_SEL_SUCCESS;
13 }
14 else
15 {
16 return UF_UI_SEL_FAILURE;
17 }
18 }
19 int Text_UI_select_edges(vector<tag_t> *vecFaces)
20 {
21 //调用API
22 char *message = "提示:选择边";
23 char *title = "标题:选择边";
24 int scope = UF_UI_SEL_SCOPE_ANY_IN_ASSEMBLY;//选取范围
25 int response;
26 int count = 0;
27 tag_p_t object;
28 UF_UI_select_with_class_dialog(message, title, scope, init_proc_select_edges, NULL, &response, &count, &object);
29 for (int i = 0; i < count; i++)
30 {
31 tag_t tagObj = object[i];
32 //取消高亮显示
33 UF_DISP_set_highlight(tagObj, 0);
34 (*vecFaces).push_back(tagObj);
35 }
36 return 0;
37 /*
38 ----------------------------------------使用方法----------------------------------------
39 vector<tag_t> vecEdges;
40 Text_UI_select_edges(&vecEdges);
41 for (int i = 0; i < vecEdges.size(); i++)
42 {
43
44 }
45 */
46 }
47
48 extern DllExport void ufusr(char *param, int *returnCode, int rlen)
49 {
50 UF_initialize();
51 vector<tag_t> vecEdges;
52 Text_UI_select_edges(&vecEdges);
53 for (int i = 0; i < vecEdges.size(); i++)
54 {
55 UF_EVAL_p_t evaluator;
56 UF_EVAL_initialize(vecEdges[i], &evaluator);
57
58
59 //确定给定的数据是否来自圆形曲线或边缘
60 bool boolIsArc;
61 UF_EVAL_is_arc(evaluator, &boolIsArc);
62 if (boolIsArc)
63 {
64 //返回圆形曲线或边的数据
65 UF_EVAL_arc_t arc;
66 UF_EVAL_ask_arc(evaluator, &arc);//arc结构体中有曲线的参数
67 }
68
69 }
70
71 UF_terminate();
72 }
73
74 extern int ufusr_ask_unload(void)
75 {
76 return (UF_UNLOAD_IMMEDIATELY);
77 }
来源:https://www.cnblogs.com/KMould/p/12560150.html