创建一个圆柱体并创建它的中心线
本帖最后由 秋爱 于 2015-7-17 23:15 编辑tag_t part_tag = NULL_TAG;
double origin = {-20.0,-20.0,-20.0};
charheight[] = "80";
chardiam [] = "30";
double direction = {0.0,0.0,1.0};
tag_tcyl_tag;
uf_list_t * edge_list;
tag_t edges;
doublectrcoodrs;
int count ;
int i=0;
UF_CURVE_line_t line_coodrs;
tag_t line_tag = NULL_TAG;
char msg ;
UF_PART_new("e:\\develop\\aa.prt",1,&part_tag); //创建部件aa
UF_MODL_create_cyl1(UF_NULLSIGN,origin,height,diam,direction,&cyl_tag);//创建圆柱体
UF_MODL_ask_feat_edges(cyl_tag,&edge_list); //通过特征找到边,并存放到链表中。
UF_MODL_ask_list_count(edge_list,&count); // 获取链表中边的个数
if(count > 0)
{
for(i=0;i<count;i++)
{
UF_MODL_ask_list_item(edge_list,i,&edges);//取出边
UF_CURVE_ask_centroid(edges,ctrcoodrs);//获取两个圆心的坐标
}
//给中心线的起点和终点赋值
line_coodrs.start_point = ctrcoodrs;
ine_coodrs.start_point = ctrcoodrs;
ine_coodrs.start_point = ctrcoodrs;
line_coodrs.end_point = ctrcoodrs;
ine_coodrs.end_point = ctrcoodrs;
ine_coodrs.end_point = ctrcoodrs;
UF_CURVE_create_line(&line_coodrs,&line_tag);//创建中心线
}
else
{
uc1601("没找到符合要求的边/圆弧",1);
return;
}
sprintf(msg,"中心线起点坐标值是x:%f,y:%f,z:%f\n中心线终点坐标值是x:%f,y:%f,z:%f\nmade by:六色彩虹",line_coodrs.start_point ,line_coodrs.start_point,line_coodrs.start_point ,line_coodrs.end_point ,line_coodrs.end_point, line_coodrs.end_point);
UF_UI_open_listing_window();
UF_UI_write_listing_window(msg);
UF_PART_save();
UF_PART_close_all();
任意转换圆柱体位置中心线随之移动
file:///C:\Users\Administrator\AppData\Roaming\Tencent\Users\749587430\QQ\WinTemp\RichOle\~~FXAW1674LNEI%YU2APKZK.png
:P很好 加油
页:
[1]