1     NX9+VS2012
 2 
 3     #include <uf.h>
 4     #include <uf_curve.h>
 5     #include <uf_modl.h>
 6 
 7 
 8     UF_initialize();
 9 
10     //圆心点
11     double p1[3] = {0.0, 0.0, 0.0};
12     tag_t CenterTag = NULL_TAG;
13     UF_CURVE_create_point(p1, &CenterTag);
14 
15     //辅助点
16     double HelpPoint[3] = {100.0, 0.0, 0.0};
17     tag_t HelpPointTag = NULL_TAG;
18     UF_CURVE_create_point(HelpPoint, &HelpPointTag);
19 
20     //类型
21     UF_CURVE_limit_t limit[2];
22     UF_CURVE_limit_p_t pLimit[2] = { &limit[0], &limit[1] };
23     limit[0].limit_type = UF_CURVE_limit_value;
24     limit[0].value = 0;//按值
25     limit[1].limit_type = UF_CURVE_limit_value;
26     limit[1].value = 90;//按值
27 
28     //创建XZ基准平面,用来放圆弧
29     double PlanePoint[3] = { 0.0, 0.0, 0.0 };
30     double Direction1[3] = { 1.0, 0.0, 0.0 };
31     tag_t DplaneTag = NULL_TAG;
32     UF_MODL_create_fixed_dplane(PlanePoint, Direction1, &DplaneTag);
33 
34     tag_t ArcTag = NULL_TAG;
35     UF_CURVE_create_arc_center_radius(CenterTag, 100, HelpPointTag, pLimit, DplaneTag, FALSE, &ArcTag);
36 
37     //创建直线
38     UF_CURVE_line_t LineCoods1;
39     LineCoods1.start_point[0] = 0.0;
40     LineCoods1.start_point[1] = 0.0;
41     LineCoods1.start_point[2] = 0.0;
42     LineCoods1.end_point[0] = 0.0;
43     LineCoods1.end_point[1] = 100.0;
44     LineCoods1.end_point[2] = 0.0;
45     tag_t Line1Tag = NULL_TAG;
46     UF_CURVE_create_line(&LineCoods1, &Line1Tag);
47 
48     UF_CURVE_line_t LineCoods2;
49     LineCoods2.start_point[0] = 0.0;
50     LineCoods2.start_point[1] = 0.0;
51     LineCoods2.start_point[2] = 0.0;
52     LineCoods2.end_point[0] = 0.0;
53     LineCoods2.end_point[1] = 0.0;
54     LineCoods2.end_point[2] = -100.0;
55     tag_t Line2Tag = NULL_TAG;
56     UF_CURVE_create_line(&LineCoods2, &Line2Tag);
57 
58     //创建旋转
59     uf_list_p_t EdgeLits;
60     UF_MODL_create_list(&EdgeLits);//创建链表
61     UF_MODL_put_list_item(EdgeLits, Line1Tag);//Tag添加到链表
62     UF_MODL_put_list_item(EdgeLits, Line2Tag);
63     UF_MODL_put_list_item(EdgeLits, ArcTag);
64 
65     char *Limit[2] = { "0.0", "360.0" };
66     double Point1[3] = { 0.0, 0.0, 0.0 };
67     double Direction[3] = { 0.0, 0.0, 1.0 };
68     UF_FEATURE_SIGN Sign = UF_NULLSIGN;
69     uf_list_p_t FeatureList;
70     UF_MODL_create_revolved(EdgeLits, Limit, Point1, Direction, Sign, &FeatureList);
71 
72     UF_MODL_delete_list(&FeatureList);//删除链表
73     UF_MODL_delete_list(&EdgeLits);
74 
75     UF_terminate();

NX二次开发-创建旋转UF_MODL_create_revolved-编程知识网