NX二次開發-建立直線UF_CURVE_create_line與NXOpen->CreateLine
阿新 • • 發佈:2018-12-12
NX11+VS2013
#include <uf.h>
#include <uf_curve.h>
#include <NXOpen/CurveCollection.hxx>
#include <NXOpen/NXObject.hxx>
#include <NXOpen/Part.hxx>
#include <NXOpen/PartCollection.hxx>
NXOpen::Session *theSession = NXOpen::Session::GetSession();
NXOpen::Part *workPart(theSession->Parts()->Work());
NXOpen::Part *displayPart(theSession->Parts()->Display());
UF_initialize();
//UFUN建立直線
UF_CURVE_line_t Line_coords;
Line_coords.start_point[0] = 0.0;
Line_coords.start_point[1] = 0.0;
Line_coords.start_point[2] = 0.0;
Line_coords.end_point[0] = 100.0;
Line_coords.end_point[1] = 100.0;
Line_coords.end_point[2] = 100.0;
tag_t Line = NULL_TAG;
UF_CURVE_create_line(&Line_coords, &Line);
//NXOpen C++建立直線
NXOpen::Point3d startPoint1(20.0, 80.0, 60.0);
NXOpen::Point3d endPoint1(200.0, 600.0, 700.0);
NXOpen::Line *line1;
line1 = workPart->Curves()->CreateLine(startPoint1, endPoint1);
UF_terminate();
Caesar盧尚宇 [email protected]