1 NX11+VS2013
2
3 #include <uf.h>
4 #include <uf_curve.h>
5 #include <NXOpen/CurveCollection.hxx>
6 #include <NXOpen/NXObject.hxx>
7 #include <NXOpen/Part.hxx>
8 #include <NXOpen/PartCollection.hxx>
9
10 NXOpen::Session *theSession = NXOpen::Session::GetSession();
11 NXOpen::Part *workPart(theSession->Parts()->Work());
12 NXOpen::Part *displayPart(theSession->Parts()->Display());
13
14 UF_initialize();
15
16 //UFUN创建直线
17 UF_CURVE_line_t Line_coords;
18 Line_coords.start_point[0] = 0.0;
19 Line_coords.start_point[1] = 0.0;
20 Line_coords.start_point[2] = 0.0;
21 Line_coords.end_point[0] = 100.0;
22 Line_coords.end_point[1] = 100.0;
23 Line_coords.end_point[2] = 100.0;
24 tag_t Line = NULL_TAG;
25 UF_CURVE_create_line(&Line_coords, &Line);
26
27 //NXOpen C++创建直线
28 NXOpen::Point3d StartPoint1(20.0, 80.0, 60.0);
29 NXOpen::Point3d EndPoint1(200.0, 600.0, 700.0);
30 NXOpen::Line *line1;
31 line1 = workPart->Curves()->CreateLine(StartPoint1, EndPoint1);
32
33 UF_terminate();