NX二次开发-获取面的法向向量UF_MODL_ask_face_data

     NX9+VS2012

     #include <uf.h>
#include <uf_modl.h>
#include <uf_obj.h>
#include <uf_ui.h> UF_initialize(); //创建圆柱
UF_FEATURE_SIGN Sign = UF_NULLSIGN;
double Origin[] = {0.0, 0.0, 0.0};
char *Height = "";
char *Diam = "";
double Direction[] = {0.0, 0.0, 1.0};
tag_t CylTag = NULL_TAG;
UF_MODL_create_cyl1(Sign, Origin, Height, Diam, Direction, &CylTag); //特征找体
tag_t BodyTag = NULL_TAG;
UF_MODL_ask_feat_body(CylTag, &BodyTag); //体找面
uf_list_p_t FaceList;
UF_MODL_ask_body_faces(BodyTag, &FaceList); //获取链表数量
int Count;
UF_MODL_ask_list_count(FaceList, &Count); UF_UI_open_listing_window();
//获取链表里的tag
for (int i = ; i < Count; i++)
{
tag_t FaceTag = NULL_TAG;
UF_MODL_ask_list_item(FaceList, i, &FaceTag); //获取面的法向
int Type;
double Point[];
double Dir[];
double Box[];
double Radius[];
double RadData[];
int NormDir;
UF_MODL_ask_face_data(FaceTag, &Type, Point, Dir, Box, Radius, RadData, &NormDir); //找圆柱侧面
if (Type == )//对比面的类型
{
//对圆柱侧面设置颜色
UF_OBJ_set_color(FaceTag, ); //打印面的法向方向
char msg[];
sprintf_s(msg, "面的法向方向为:\nX:%.0f\nY:%.0f\nZ:%.0f\n", Dir[], Dir[], Dir[]);
UF_UI_write_listing_window(msg);
}
} //释放内存
UF_MODL_delete_list(&FaceList); UF_terminate();

NX二次开发-获取面的法向向量UF_MODL_ask_face_data

上一篇:Get ListView items from other windows z


下一篇:Log4j简单配置