函数说明:
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_t region Input faces to be operated char * offset Input offset value, in expression string tag_t * feature_tag Output feature_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(®ion_t, offset_value_str, &offset_feature));