查看: 3434|回复: 1

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

 火 [复制链接]

1

主题

18

回帖

197

积分

培训VIP会员

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

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

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

×
double origin[3]={50,100,200};0 k. X% }2 ?3 K$ D/ G' d
double dir[3]={1,1,1};6 k8 }4 L; t! H, J% y& U8 K
double poinTCoords1[3];- r& g' b, ~; f& H9 g" Y# d8 D
double pointCoords2[3];( x- i) g3 f1 o

; t3 T2 W; S: }2 g& F6 U1 `# M4 rtag_t partTag=NULL_TAG;
5 u8 A1 @) q/ O( D5 ?8 P* |tag_t cylTag=NULL_TAG;, ~& Q' u; u; T, ~& T
tag_t lineTag=NULL_TAG;
0 M$ t* l# E; q9 z3 Atag_t sopointTag=NULL_TAG;, m4 O5 [: {& j% T8 E- D6 y# d4 z
6 @2 o/ B. T8 Q/ ]- s& K& I, }
int errorCode=0;
/ }/ f; h: P( \, c) f  f' yint res=0;5 O. C( V) Y* E: u. J1 s0 ?, a8 r4 g
/ i2 M( u* a8 h# m3 |1 W
UF_CURVE_line_t line_coords;) J! A& T8 R/ y
UF_CURVE_line_t line_coords1;
. Z" E4 ~6 Q/ e4 O% xUF_UI_POINT_base_method_t base_method = UF_UI_POINT_CENTER_PT;
( `6 ^. o# u- kUF_system_info_t time;: w" t$ w' j2 H( A4 Y

4 U1 W) Q- B$ j9 U  s9 H! `0 Rchar msg[256];
5 |) E$ f, U/ v' j* M! d0 }4 R$ b& m
errorCode=UF_PART_new("D;\\UG\\myhomework.prt",1,&partTag);//创建myhomework部件;8 c# k+ Z, c0 Q9 v0 P. }
        if (errorCode)//判断部件是否已经存在;
3 w8 @# R# c- K        {: k# ~& M0 T' Q: T6 _% [
                uc1601("The Part already existed",1);5 p( l/ l- k6 y2 O; Y5 r
        }
/ y2 q; C3 t' ~* ?        UF_CALL(UF_MODL_create_cyl1(UF_NULLSIGN,origin,"300","100",dir,&cylTag));//创建圆柱体;
! g. b0 {% O. r2 P        UF_UI_point_construct("Please select one point",&base_method,&sopointTag,pointCoords1,&res);//利用点构造器选取中心线起点
( `2 R, k+ m6 s1 L        line_coords.start_point[0]=pointCoords1[0];* t: P  D; j4 x( R( }4 s  ], h
        line_coords.start_point[1]=pointCoords1[1];2 E0 e! v2 o6 e( W
        line_coords.start_point[2]=pointCoords1[2];, ~5 Z' p: h) h
        UF_UI_point_construct("Please select one point",&base_method,&sopointTag,pointCoords2,&res);//选取中心线终点' P0 [. K/ ]) d# z* G7 d' r
        line_coords.end_point[0]=pointCoords2[0];1 i) y" ~. U1 c9 f
        line_coords.end_point[1]=pointCoords2[1];
( t7 b8 H: t/ i1 s        line_coords.end_point[2]=pointCoords2[2];
3 Y' L7 S. S( @, m        UF_CURVE_create_line(&line_coords,&lineTag);//创建中心线
* A6 D' k8 d# O- }* e5 c* x+ @        UF_CURVE_ask_line_data(lineTag,&line_coords1);//访问中心线信息
" k# h! p2 C& L, @8 ^) `2 ^& T/ B        UF_ask_system_info(&time);//访问系统时间
% C7 h5 f6 z6 s       
5 K" J. K& L  R7 \: x$ q        sprintf(msg,"start point:x=%f,y=%f,z=%f\nend point:x=%f,y=%f,z=%f\nAuthor;Honey\nTime:",, S5 _' U, o, {0 d0 P
                pointCoords1[0],pointCoords1[1],pointCoords1[2],pointCoords2[0],pointCoords2[1],pointCoords2[2]);
9 H9 I6 I$ O& f; L       
# [" v: ?2 u3 l& M        UF_UI_open_listing_window();3 H* F5 W( P/ H' I" }6 ?! M* _
        UF_UI_write_listing_window(msg);
2 r8 Q  T, Q8 e# u8 h9 B' P) C        UF_UI_open_listing_window();+ G9 j5 A* u; l* E  ^! y; C
        UF_UI_write_listing_window(time.date_buf);6 G$ W; l, r/ X' ^, D$ h0 `8 h0 g5 h
        UF_PART_save();! l2 Y' h* W  K; c
5 R9 o& ~8 j3 v: t8 R/ ~
0 X# G7 k8 T. C7 Q+ Z

评分

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

查看全部评分

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

使用道具 举报

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

本版积分规则

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