NX二次开发-UFUN获取点集里的点数量和所有点tag UF_MODL_ask_points_parms


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日

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM