马上注册,结交更多同行朋友,交流,分享,学习。
您需要 登录 才可以下载或查看,没有帐号?注册
x
使用UF_MODL_create_extruded 拉伸实体,得不到预想结果,拉伸不出实体
程序如下:
static void do_ugopen_apiNX(void)
{
double diameter = 50.000000000000;
double height = 50.000000000000;
double length = 20.000000000000;
double direction[3] = {0.0,0.0,1.0};//defaut extrude direction--Z axis
double ref_pt[3] ;
double arc1_range[2] = {270, 450}, arc_rad = diameter/2;
double arc2_range[2] = {90, 270 }; //两段圆弧的半径相等
char *taper_angle = "0.0"; //没有拔模斜度
char *limits[2] = {"0.0", "10.0"} ; //height > width/2;
char extrude_length[20] = "";
_gcvt(height-diameter/2.0, 20, extrude_length);
//limits[1] = extrude_length;
uc1601(extrude_length, 1);
int i, count=4;
tag_t obj_array[5], wcs_tag, matrix_tag;
uf_list_p_t loop_list, features;
UF_FEATURE_SIGN create = UF_NULLSIGN ;
UF_CURVE_line_t line1, line2, line3, line4;
UF_CURVE_arc_t arc1, arc2;
//默认在x , y平面上生成所需要的封闭线,以便拉伸, 即z向为0, 逆时针方向
//length = 20, diameter = 50.0;
line1.start_point[0] = length*0.5;
line1.start_point[1] = arc_rad;
line1.start_point[2] = 0.0;
line1.end_point[0] = -length*0.5;
line1.end_point[1] = arc_rad;
line1.end_point[2] = 0.0;
line2.start_point[0] = line1.end_point[0];
line2.start_point[1] = line1.end_point[1];
line2.start_point[2] = line1.end_point[2];
line2.end_point[0] = line1.end_point[0];
line2.end_point[1] = -line1.end_point[1];
line2.end_point[2] = line1.end_point[2];
line3.start_point[0] = line2.end_point[0];
line3.start_point[1] = line2.end_point[1];
line3.start_point[2] = line2.end_point[2];
line3.end_point[0] = -line2.end_point[0];
line3.end_point[1] = line2.end_point[1];
line3.end_point[2] = line2.end_point[2];
line4.start_point[0] = line3.end_point[0];
line4.start_point[1] = line3.end_point[1];
line4.start_point[2] = line3.end_point[2];
line4.end_point[0] = line1.start_point[0];
line4.end_point[1] = line1.start_point[1];
line4.end_point[2] = line1.start_point[2];
arc1.start_angle = (PI/180) * arc1_range[0]; arc1.end_angle = (PI/180) * arc1_range[1];
arc1.arc_center[0] = length/2; arc1.arc_center[1] = arc1.arc_center[2] = 0.0;
arc1.radius = arc_rad;
arc2.start_angle = (PI/180) * arc2_range[0]; arc2.end_angle = (PI/180) * arc2_range[1];
arc2.arc_center[0] = -length/2; arc2.arc_center[1] = arc2.arc_center[2] = 0.0;
arc2.radius = arc_rad;
UF_CALL(UF_CURVE_create_line(&line1, &obj_array[0]));
UF_CALL(UF_CURVE_create_line(&line2, &obj_array[1]));
UF_CALL(UF_CURVE_create_line(&line3, &obj_array[2]));
UF_CALL(UF_CURVE_create_line(&line4, &obj_array[3]));
/*UF_CALL(UF_CSYS_ask_wcs(&wcs_tag));
UF_CALL(UF_CSYS_ask_matrix_of_object(wcs_tag, &matrix_tag));
arc1.matrix_tag = matrix_tag;
arc2.matrix_tag = matrix_tag;
UF_CALL(UF_CURVE_create_arc(&arc2, &obj_array[1]));
UF_CALL(UF_CURVE_create_arc(&arc1, &obj_array[3]));*/
UF_CALL(UF_MODL_create_list(&loop_list));
for(i = 0; i < count; i++) {
UF_CALL(UF_MODL_put_list_item(loop_list, obj_array[i]));
}
UF_CALL(UF_MODL_create_extruded(loop_list, taper_angle, limits, ref_pt, direction, create, &features));
} |