PLM之家PLMHome-国产软件践行者

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

  [复制链接]

2015-7-17 20:00:24 2918 1

hcaini0829 发表于 2015-7-17 17:46:30 |阅读模式

hcaini0829 楼主

2015-7-17 17:46:30

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

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

x
double origin[3]={50,100,200};
( Y( g1 m! i- y2 x9 udouble dir[3]={1,1,1};8 D- {4 x3 d8 x2 R" @
double poinTCoords1[3];) n2 C+ q0 K: ?+ V6 }( D
double pointCoords2[3];8 \  f1 Q% b2 E

  e7 X1 y5 O8 Q! Ntag_t partTag=NULL_TAG;
. i( [' }. `$ K4 ]( T0 }  ~0 Stag_t cylTag=NULL_TAG;# ]  }% _  [( `9 Q
tag_t lineTag=NULL_TAG;
6 c  s( j3 o/ R5 K' ^6 E% jtag_t sopointTag=NULL_TAG;
+ j. v; l' a- @' i0 q* i
7 S( e1 \. V4 n; H' Pint errorCode=0;5 E  ]3 \8 d0 [3 R( u/ z
int res=0;
. ~* Z* h! V# S: k/ L0 r' r
6 }6 V" Q8 N  @UF_CURVE_line_t line_coords;
' ?1 E1 A( [& F7 ?& J0 T: AUF_CURVE_line_t line_coords1;
* @. l" K$ Q+ |" }% d7 {UF_UI_POINT_base_method_t base_method = UF_UI_POINT_CENTER_PT;) t  h2 N( J: `9 Q
UF_system_info_t time;
2 V! n+ i' u) a, l& {0 y. V" C2 _, {" j$ B) A( v' \0 x
char msg[256];% Z) Y1 c& c3 ?/ v, V
3 `) P' G% ~- p9 G
errorCode=UF_PART_new("D;\\UG\\myhomework.prt",1,&partTag);//创建myhomework部件;6 g+ Z% [! [! W
        if (errorCode)//判断部件是否已经存在;
* p- L$ M* Q% Q6 G7 S        {
" I4 m$ ]2 j  \- u. q                uc1601("The Part already existed",1);
: U2 n( W5 ]  A: l7 F6 {8 d7 ^        }
5 Q# x5 s" T4 }) ~        UF_CALL(UF_MODL_create_cyl1(UF_NULLSIGN,origin,"300","100",dir,&cylTag));//创建圆柱体;) g8 N+ N  [' J0 y5 L; r% c
        UF_UI_point_construct("Please select one point",&base_method,&sopointTag,pointCoords1,&res);//利用点构造器选取中心线起点: d* ]' {; H  w, _8 T5 G) o0 C/ Y$ W, |
        line_coords.start_point[0]=pointCoords1[0];8 K" V% U& l4 x# C4 g
        line_coords.start_point[1]=pointCoords1[1];" i7 [" _% e% @8 d# Q8 M* f( v
        line_coords.start_point[2]=pointCoords1[2];  a: K( T& r# h+ J3 F
        UF_UI_point_construct("Please select one point",&base_method,&sopointTag,pointCoords2,&res);//选取中心线终点
, i7 g* S6 R9 n        line_coords.end_point[0]=pointCoords2[0];
4 y5 k( w+ L; j' a% T2 C        line_coords.end_point[1]=pointCoords2[1];
; N/ h( v3 j2 i- g+ L3 Z        line_coords.end_point[2]=pointCoords2[2];+ F8 A9 B2 W2 O$ Y7 o$ V: ?2 L
        UF_CURVE_create_line(&line_coords,&lineTag);//创建中心线- o6 \, O; B7 c8 @/ C: Q
        UF_CURVE_ask_line_data(lineTag,&line_coords1);//访问中心线信息
' V0 G+ c8 O) v1 X2 t1 Y: ^" L2 }        UF_ask_system_info(&time);//访问系统时间
1 m; N! a& ]( r# I3 Z- ~        ) l6 W3 F- `! |$ o5 ]: @# F
        sprintf(msg,"start point:x=%f,y=%f,z=%f\nend point:x=%f,y=%f,z=%f\nAuthor;Honey\nTime:",
2 }, Y0 b7 P# Y" v                pointCoords1[0],pointCoords1[1],pointCoords1[2],pointCoords2[0],pointCoords2[1],pointCoords2[2]);5 D  g. l- a$ J$ X
       
. a( k' ^+ P8 V- t4 O        UF_UI_open_listing_window();
" Y) b# D+ }6 h, ~        UF_UI_write_listing_window(msg);1 }) B+ o, d9 K* c) j3 Z! w
        UF_UI_open_listing_window();
4 m0 e# t8 l) i/ r, f) [        UF_UI_write_listing_window(time.date_buf);
1 [3 C% y) @& }7 Y* J        UF_PART_save();4 w$ Z2 }/ a* J
2 @! Q! [+ N; F, Y

# L8 a2 e. ~# a# N$ j5 M

评分

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

查看全部评分

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

使用道具 举报

全部回复1

发表回复

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

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

    本网站(plmhome.com)为PLM之家工业软件学习官网站

    展示的视频材料全部免费,需要高清和特殊技术支持请联系 QQ: 939801026

    PLM之家NX CAM二次开发专题模块培训报名开始啦

    我知道了