UG|NX 二次开发 UF_MODL_create_offset_region 的使用

函数说明:

UF_MODL_create_offset_region (view source) 

Defined in: uf_modl_dfo.h 
Overview
This function offset a region by a given distance along face normals.
Environment
Internal and External  
Required License(s)
solid_modeling
 
int UF_MODL_create_offset_region(
UF_MODL_dfo_region_p_t region, char * offset, tag_t * feature_tag
)
UF_MODL_dfo_region_p_tregionInputfaces to be operated
char *offsetInputoffset value, in expression string
tag_t *feature_tagOutputfeature_tag created by the operation.

使用代码实例:

        int face_count;
	UF_MODL_ask_list_count(faces_pt, &face_count);

	tag_t * seed_faces = new tag_t[face_count-2];

	//选出要offset的面
	int j=0;
	for (int i=0; i<face_count; ++i)
	{
		tag_t i_face;
		UF_MODL_ask_list_item(faces_pt, i, &i_face);
		double i_face_dir[3];
		UF_MODL_ask_face_data(i_face,&tmp_face_type,point,i_face_dir,box,&radius,&rad_data,&norm_dir);
		int i_face_type;
		UF_MODL_ask_face_type(i_face, &i_face_type);
		double ang = angleBetween2Directions(i_face_dir, face_dir);
		bool is_face_extruded_from_convex_edge = false;
		for (auto k_edge : convex_adj_edges_vec)
		{
			if (MHY_ask_is_edge_on_face(k_edge, i_face))
			{
				is_face_extruded_from_convex_edge = true;
				break;
			}
		}
		if ( !((ang<1 || ang>179) && i_face_type == UF_MODL_PLANAR_FACE)  //排除拉伸体的上下底面
			&&   !is_face_extruded_from_convex_edge) //排除凸边相邻的面
		{
			seed_faces[j] = i_face;
			++j;
		}
	}

	UF_MODL_dfo_region_t region_t;
	region_t.seed_faces = seed_faces;
	region_t.num_seed = j;
	region_t.boundary_faces = nullptr;
	region_t.num_boundary = 0;
	region_t.excluded_faces = nullptr;
	region_t.num_exclude = 0;

	char offset_value_str[100];
	sprintf_s(offset_value_str, "%.2f", offset_dis);
	tag_t offset_feature;
	UF_CALL(UF_MODL_create_offset_region(&region_t, offset_value_str, &offset_feature));

最终效果:


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值