NX9+VS2012 #include <uf.h> #include <uf_curve.h> #include <uf_modl.h> #include <uf_ui.h> UF_initialize(); //創建點 double pointCoords1[3] = {0,10,20}; tag_t point1Tag = NULL_TAG; UF_CURVE_create_point(pointCoords1, &point1Tag); double pointCoords2[3] = {0,40,50}; tag_t point2Tag = NULL_TAG; UF_CURVE_create_point(pointCoords2, &point2Tag); double pointCoords3[3] = {0,70,80}; tag_t point3Tag = NULL_TAG; UF_CURVE_create_point(pointCoords3, &point3Tag); double pointCoords4[3] = {0,100,110}; tag_t point4Tag = NULL_TAG; UF_CURVE_create_point(pointCoords4, &point4Tag); //創建點集 tag_t points[4] = {point1Tag, point2Tag,point3Tag,point4Tag}; tag_t feature_tag = NULL_TAG; UF_MODL_create_points_feature(4, points, &feature_tag); //獲取點集里的點數量和所有點tag int num_points = 0; tag_t* ponts = NULL_TAG; UF_MODL_ask_points_parms(feature_tag, &num_points, &ponts); UF_UI_open_listing_window(); for (int i = 0; i < num_points; i++) { //獲得點的坐標 double p1[3]; UF_CURVE_ask_point_data(ponts[i], p1); //打印 char msg[256]; sprintf_s(msg, "X:%f, Y:%f, Z:%f", p1[0], p1[1], p1[2]); UF_UI_write_listing_window(msg); UF_UI_write_listing_window("\n"); } //釋放 UF_free(ponts); UF_terminate(); Caesar盧尚宇 2020年11月20日