NX11+VS2013
#include <uf.h>
#include <uf_modl.h>
#include <NXOpen/Face.hxx>
#include <uf_ui.h>
#include <NXOpen/NXObjectManager.hxx>
#include <NXOpen/Edge.hxx>
UF_initialize();
//获取选择面控件选择的对象
PropertyList* FaceSelectProps = face_select0->GetProperties();
std::vector<NXOpen::TaggedObject *> Faces = FaceSelectProps->GetTaggedObjectVector("SelectedObjects");
delete FaceSelectProps;
FaceSelectProps = NULL;
for (int i = 0; i < Faces.size(); i++)
{
NXOpen::Face *MyFace = dynamic_cast<NXOpen::Face *>(Faces[i]);
std::vector<tag_t> FaceNum;
uf_loop_p_t Loop_List;
UF_MODL_ask_face_loops(MyFace->Tag(), &Loop_List);//查询面的边界
int LoopNum;
UF_MODL_ask_loop_list_count(Loop_List, &LoopNum);//查询面的边界链表数量
int LoopChildType;
int Num1;
uf_list_p_t LoopChildList;
char msg[256];
std::vector<tag_t> edge;
UF_MODL_create_list(&LoopChildList);//创建链表
for (int j = 0; j < LoopNum; j++)
{
UF_MODL_ask_loop_list_item(Loop_List, j, &LoopChildType, &LoopChildList);//查询面的边界类型
if (LoopChildType == 2)//类型为内边界的时候
{
UF_MODL_ask_list_count(LoopChildList, &Num1);//查询链表数量
for (int n = 0; n < Num1; n++)
{
tag_t objTag = NULL_TAG;
UF_MODL_ask_list_item(LoopChildList, n, &objTag);//获取链表里的tag
edge.push_back(objTag);
}
}
}
sprintf_s(msg, "当前有%d个孔", edge.size());
uc1601(msg, 1);
UF_MODL_delete_list(&LoopChildList);
UF_MODL_delete_loop_list(&Loop_List);
}
UF_terminate();
Caesar卢尚宇 [email protected]
NX二次开发-UFUN获取面的内外边界UF_MODL_ask_loop_list_item
猜你喜欢
转载自blog.csdn.net/lu1287580078/article/details/82947981
今日推荐
周排行