NX二次开发-UFUN获取边的端点UF_MODL_ask_edge_verts

NX9+VS2012

#include <uf.h>
#include <uf_modl.h>
#include <uf_ui.h>
#include <uf_disp.h>
#include <uf_obj.h>
#include <NXOpen/Annotations.hxx>

UF_initialize();

//创建块
UF_FEATURE_SIGN Sign = UF_NULLSIGN;
double Corner_Pt[3] = {25.0, 37.0, 48.0};
char *Edge_Len[3] = {"105", "135", "142"};
tag_t BlkTag = NULL_TAG;
UF_MODL_create_block1(Sign, Corner_Pt, Edge_Len, &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);

//转换
char msg1[256];
sprintf_s(msg1, "当前体有%d条边\n每条边的两个端点如下:\n", Count);
//打印
UF_UI_open_listing_window();
UF_UI_write_listing_window(msg1);
for (int i = 0; i < Count; i++)
{
	//获取链表里的tag
	tag_t Edge_Tag = NULL_TAG;
	UF_MODL_ask_list_item(EdgeList, i, &Edge_Tag);

	//高亮所有边
	UF_DISP_set_highlight(Edge_Tag, 1);

	//获取边的端点
	double Point1[3];
	double Point2[3];
	int PointNum;
	UF_MODL_ask_edge_verts(Edge_Tag, Point1, Point2, &PointNum);

	//转换
	char msg2[256];
	sprintf_s(msg2, "X坐标:%.0f,  Y坐标:%.0f,  Z坐标:%.0f\nX坐标:%.0f,  Y坐标:%.0f,  Z坐标:%.0f\n", Point1[0], Point1[1], Point1[2], Point2[0], Point2[1], Point2[2]);
	//打印			
	UF_UI_write_listing_window(msg2);
}

UF_terminate();

Caesar卢尚宇  [email protected]

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/lu1287580078/article/details/82960636