【NX二次开发】获取片体的边UF_MODL_ask_body_boundaries()

获取片体的边UF_MODL_ask_body_boundaries(),如果输入实体,则获取的片体的边的数量为0.

源码:

#include "Text.h"
extern DllExport void ufusr(char *param, int *returnCode, int rlen)
{
    UF_initialize();
    tag_t tagBody = 44971;
    //输入必须是片体,可以先用UF_MODL_ask_body_type()进行判断。
    int iBoundariesCount = 0;
    int *iEdgesCount;
    tag_t *tagEdges;
    int iEdgeSumCount = 0;
    UF_MODL_ask_body_boundaries(tagBody, &iBoundariesCount, &iEdgesCount, &tagEdges);
    list("iBoundariesCount=%d\n", iBoundariesCount);

     for (int i = 0; i < iBoundariesCount; i++)
     {
         list("iEdgesCount[%d] = %d\n", i, iEdgesCount[i]);
        iEdgeSumCount += iEdgesCount[i];
    }
    for (int i = 0; i < iEdgeSumCount; i++)
    {
        list("tagEdges[%d] = %d\n", i, tagEdges[i]);
        UF_DISP_set_highlight(tagEdges[i], TRUE);//TRUE高亮显示  FALSE取消高亮显示
        uc1601("pause", 1);
        UF_DISP_set_highlight(tagEdges[i], FALSE);//TRUE高亮显示  FALSE取消高亮显示
    }
    UF_free(iEdgesCount);
    UF_free(tagEdges);
    UF_terminate();
}

extern int ufusr_ask_unload(void)
{
    return (UF_UNLOAD_IMMEDIATELY);
}

 

效果:

 

posted @ 2020-11-23 14:36  王牌飞行员_里海  阅读(224)  评论(0编辑  收藏  举报