查看: 3298|回复: 1

[交作业] 2015.7.12_Lession2创建圆柱体并得到中心线的起点终点的信息

 火 [复制链接]

1

主题

18

回帖

197

积分

培训VIP会员

积分
197
发表于 2015-7-17 17:46:30 | 显示全部楼层 |阅读模式

请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!

您需要 登录 才可以下载或查看,没有账号?注册

×
double origin[3]={50,100,200};) P1 z# E0 z* _3 u" P) v7 d! j3 j
double dir[3]={1,1,1};
$ N$ w# `/ {$ A) hdouble poinTCoords1[3];
* b+ A7 a6 S) }double pointCoords2[3];
3 c8 A% k8 \% \8 z( O# |( h9 I, z* U0 B
tag_t partTag=NULL_TAG;
6 F9 ~5 Q; G. o' h! |tag_t cylTag=NULL_TAG;( N3 m9 d( k* K# s3 r- \% c
tag_t lineTag=NULL_TAG;
' b& k7 ~+ I( v- s* g( ntag_t sopointTag=NULL_TAG;
. A9 S; k% \# B) p3 s2 Y3 ~% u3 ]1 L. q7 E
int errorCode=0;
% x' T; Q- ?' j/ K8 i& uint res=0;7 y# H8 u' u7 U' N
5 ^2 v& i& u% v" a
UF_CURVE_line_t line_coords;
9 b! A0 r' {$ @5 V/ S- d) L  n8 XUF_CURVE_line_t line_coords1;
) K1 S: ^# ~( V2 j. W, [, JUF_UI_POINT_base_method_t base_method = UF_UI_POINT_CENTER_PT;
- R9 T: ?* u! W. d. Z4 wUF_system_info_t time;5 y, A1 ]% V" W- e
) G  ~. q  d+ y9 O( T& r
char msg[256];
6 y3 g: F6 E0 G# k& T% t* \* R
, d1 P* u' u* r( `errorCode=UF_PART_new("D;\\UG\\myhomework.prt",1,&partTag);//创建myhomework部件;. p) }: U6 o5 R0 t: \
        if (errorCode)//判断部件是否已经存在;
% o7 d. Z! Y8 c. L        {
5 l, W8 i) l: x+ t, e& h8 b' Q: Q                uc1601("The Part already existed",1);' \9 q' ~( ~# q( B/ ?; _" C# e* g7 R
        }0 B+ Z: J# v6 s+ P! Y
        UF_CALL(UF_MODL_create_cyl1(UF_NULLSIGN,origin,"300","100",dir,&cylTag));//创建圆柱体;
: K: U# g' f9 J# e, m        UF_UI_point_construct("Please select one point",&base_method,&sopointTag,pointCoords1,&res);//利用点构造器选取中心线起点4 v8 X: q0 D8 m+ `% N
        line_coords.start_point[0]=pointCoords1[0];
- H; b  z9 |# k9 F$ R/ v2 |6 K1 B        line_coords.start_point[1]=pointCoords1[1];* D  F, I* ]% S1 C- ^9 ?
        line_coords.start_point[2]=pointCoords1[2];2 T4 H+ r& |( b7 P
        UF_UI_point_construct("Please select one point",&base_method,&sopointTag,pointCoords2,&res);//选取中心线终点% _+ Z8 o& g) u; ?1 n0 {0 b
        line_coords.end_point[0]=pointCoords2[0];
' N9 T2 `9 a9 [- m" E        line_coords.end_point[1]=pointCoords2[1];
0 y6 R5 c. Z, g1 i* X        line_coords.end_point[2]=pointCoords2[2];3 p+ x: Z. {  g- c" }/ C6 g( F
        UF_CURVE_create_line(&line_coords,&lineTag);//创建中心线
* ?: Q& O9 Q9 f; M/ F" \        UF_CURVE_ask_line_data(lineTag,&line_coords1);//访问中心线信息
& ~( q4 g: ^+ V: k" t4 k3 ^        UF_ask_system_info(&time);//访问系统时间
9 I( d' F1 c4 s! C; U0 O5 b* V       
+ s/ e% A  g0 ^5 X        sprintf(msg,"start point:x=%f,y=%f,z=%f\nend point:x=%f,y=%f,z=%f\nAuthor;Honey\nTime:",
/ z! {$ Z& {* L3 M, n                pointCoords1[0],pointCoords1[1],pointCoords1[2],pointCoords2[0],pointCoords2[1],pointCoords2[2]);4 G) j" h) ^2 y) e
       
' `2 F( E, V" ?        UF_UI_open_listing_window();' A- y# v1 l6 R  _9 O
        UF_UI_write_listing_window(msg);
/ s8 d/ b3 Q9 r5 U) a* J# M/ I        UF_UI_open_listing_window();! G# A1 }, l, g4 ?6 v: l3 G
        UF_UI_write_listing_window(time.date_buf);- L0 J9 g; o  |5 f# M
        UF_PART_save();# I4 L% d( e- h, A8 n8 ~) [

7 O0 Z! H: K# q/ [  b+ Q! m9 ]9 a8 R9 M7 ?

评分

参与人数 1PLM币 +5 收起 理由
admin + 5 很给力!

查看全部评分

上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.doteam.tech
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

在本版发帖
关注公众号
QQ客服返回顶部