2016.3.13 lesson2-创建圆柱及中心线并获取信息
代码://创建new part
tag_t part;
UF_PART_new("D:\\newpart_001.part",1,&part);
//创建圆柱
double origin [ 3 ];
origin=-100.0;
origin=-100.0;
origin=-100.0;
char *height="200";
char *diam="120";
double direction [ 3 ];
direction=0;
direction=0;
direction=1;
tag_t cyl;
UF_MODL_create_cyl1(UF_NULLSIGN,origin,height,diam,direction,&cyl);
//创建中心线
UF_CURVE_line_t line_coords;
line_coords.start_point=origin;
line_coords.start_point=origin;
line_coords.start_point=origin;
line_coords.end_point=origin;
line_coords.end_point=origin;
line_coords.end_point=origin+200.0;
tag_t line;
UF_CURVE_create_line(&line_coords,&line);
//获取曲线参数
UF_CURVE_line_t the_line_coords;
UF_CURVE_ask_line_data(line,&the_line_coords);
char msg;
sprintf(msg,"起点 point_x:%f\tpoint_y:%f\tpoint_z:%f\n终点 point_x:%f\tpoint_y:%f\tpoint_z:%f\n",
the_line_coords.start_point,the_line_coords.start_point,the_line_coords.start_point,
the_line_coords.end_point,the_line_coords.end_point,the_line_coords.end_point);
UF_UI_open_listing_window();
UF_UI_write_listing_window(msg);
UF_PART_save();
UF_PART_close(part,1,0);
运行效果:
不错 如果你更改下 圆柱的方向,你的还能正确显示吗?
页:
[1]