NX二次開發-UFUN特徵找xxx UF_MODL_ask_feat_xxx等函式(待補充)
阿新 • • 發佈:2018-12-14
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 CornerPt[3] = {0.0, 0.0, 0.0};
char *EdgeLen[3] = {"100", "100", "100"};
tag_t BlkTag = NULL_TAG;
UF_MODL_create_block1(Sign, CornerPt, EdgeLen, &BlkTag);
//==============================================
//特徵找體
tag_t BodyTag = NULL_TAG;
UF_MODL_ask_feat_body(BlkTag, &BodyTag);
//把體設定成紅色
UF_OBJ_set_color(BodyTag, 186);
//================================================
/*
//特徵找邊
uf_list_p_t EdgeList;
UF_MODL_ask_feat_edges(BlkTag, &EdgeList);
//獲取連結串列數量
int Count;
UF_MODL_ask_list_count(EdgeList, &Count);
UF_UI_open_listing_window();
char msg[256];
sprintf_s(msg, "當前體有%d條邊\n", Count);
UF_UI_write_listing_window(msg);
for (int i = 0; i < Count; i++)
{
tag_t EdgeTAG = NULL_TAG;
UF_MODL_ask_list_item(EdgeList, i, &EdgeTAG);//獲得每條邊的tag
sprintf_s(msg, "tag=%d\n", EdgeTAG);
UF_UI_write_listing_window(msg);
}
//刪除連結串列
UF_MODL_delete_list(&EdgeList);
*/
//===========================================
/*
//特徵找方向
double DirX[3];
double DirY[3];
UF_MODL_ask_feat_direction(BlkTag, DirX, DirY);
UF_UI_open_listing_window();
char msg[256];
sprintf_s(msg, "%f, %f, %f\n%f, %f, %f", DirX[0], DirX[1], DirX[2], DirY[0], DirY[1], DirY[2]);
UF_UI_write_listing_window(msg);
*/
//==============================================
/*
//特徵找面
uf_list_p_t FaceList;
UF_MODL_ask_feat_faces(BlkTag, &FaceList);
//獲取連結串列數量
int Count;
UF_MODL_ask_list_count(FaceList, &Count);
UF_UI_open_listing_window();
char msg[256];
sprintf_s(msg, "當前體有%d個面\n", Count);
UF_UI_write_listing_window(msg);
for (int i = 0; i < Count; i++)
{
tag_t FaceTAG = NULL_TAG;
UF_MODL_ask_list_item(FaceList, i, &FaceTAG);//獲得每個面的tag
sprintf_s(msg, "tag=%d\n", FaceTAG);
UF_UI_write_listing_window(msg);
}
//刪除連結串列
UF_MODL_delete_list(&FaceList);
*/
//================================================
/*
//獲取特徵的時間戳記名字
char *FeatureName;
UF_MODL_ask_feat_name(BlkTag, &FeatureName);
UF_UI_open_listing_window();
UF_UI_write_listing_window(FeatureName);
UF_free(FeatureName);
*/
UF_terminate();
Caesar盧尚宇 [email protected]