PLM之家精品课程培训

PLM之家精品课程培训

联系电话:18301858168   |   QQ咨询:939801026
NX二次开发培训

NX二次开发培训

UFUN/NXOpen C++和实战案例

适合初级入门或想深入了解二次开发的工程师,本培训结合ufun,NXOpen C++,大量的实例及官方内部的开发技术。
公众号二维码

关注公众号

点击扫描二维码免费在线高清教程

课程详情
Catia二次开发培训

Catia二次开发培训

市场需求大,掌握核心技术前景广阔

Catia二次开发的市场需求大,人才稀缺。掌握开发技能潜力巨大,随着经验积累将在汽车、航空等领域有所作为。
B站二维码

在线原创B站视频

点击关注工业软件传道士主页

课程详情
Teamcenter培训

Teamcenter培训

全方位培训,从基础应用到高级开发全覆盖

涵盖用户应用基础培训、管理员基础培训、管理员高级培训及二次开发培训等全方位内容,由多年经验讲师打造。
QQ群二维码

加入同行交流

点击扫描二维码加入QQ群

课程详情
×

PLM之家plmhome公众号

课程涵盖: PLM之家所有原创视频

×

关注B站视频

所有高清视频一览无余,全部在线播放学习

×

加入PLM之家QQ群

同行交流,疑问解答,更多互助

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

[二次开发源码] NX 二次开发中创建曲线命令及获取点,线,圆弧信息源码

[复制链接]

2013-11-27 15:21:12 2828 0

admin 发表于 2013-11-27 15:21:12 |阅读模式

admin 楼主

2013-11-27 15:21:12

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

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

x
NX 二次开发中创建曲线命令及获取点,线,圆弧信息源码
+ j* a' V9 o8 J+ d9 e/ b/ T: W
! t, |7 Z) @6 E4 {8 P  l
  1. <p>static void do_UGopenapi()4 }  u# M0 Y7 w3 m& S8 ?0 L
  2. {
    - e" c" c$ S/ g! A: k# a3 |
  3. /*
    0 Q! [8 b6 m, J% p% U* `. H
  4. Create Curve( K& `8 B. O) V7 b. ~3 Y" J9 j
  5. */
    * y" W4 }5 G8 a% E& Z, @
  6. // create line
    " G$ _: o. w- U7 ^
  7. UF_CURVE_line_t line_coords;' D, R: G) @% H! ~( |* X
  8. tag_t line;# f) [& n, O) ~, Q, R1 S
  9. line_coords.start_point[0]=0;% P. X0 Y+ @5 z, N1 R0 \  y
  10. line_coords.start_point[1]=0;8 L: \) m2 ?! H; |2 E
  11. line_coords.start_point[2]=0;
      c; x" ^0 [8 V' l# e/ s! J4 a
  12. line_coords.end_point[0]=100;( j- b7 a3 T- J7 p/ F  N. ^$ k
  13. line_coords.end_point[1]=100;  S, }' C1 P( ]' X: W  Y
  14. line_coords.end_point[2]=100;) V5 B, E+ A2 Y4 h
  15. UF_CURVE_create_line(&line_coords,&line);</p><p> //create arc* T; G6 T$ R: z' I
  16. UF_CURVE_arc_t arc_coords;/ }  C+ }# y: i3 }
  17. tag_t arc,marix,wcs;# p9 `. \5 @9 Z  H. o
  18. UF_CSYS_ask_wcs(&wcs);; Z/ P7 {* L& X9 k. `: c
  19. UF_CSYS_ask_matrix_of_object(wcs,&marix);1 B# k4 i7 E$ D. O
  20. arc_coords.arc_center[0]=0;
    + V! Z" m, A7 a8 b- K/ G6 ]
  21. arc_coords.arc_center[1]=0;: d( G  d. ~2 x( v8 j$ [; C! m% o
  22. arc_coords.arc_center[2]=0;2 V( r. q. ?. v0 H4 {& T
  23. arc_coords.start_angle=90*DEGRA;
    5 ]6 h# t6 c- |& j) D+ F& F8 l5 J
  24. arc_coords.end_angle=270*DEGRA;" d  |" m" j7 n
  25. arc_coords.radius=100;! `% x0 Y/ V" Z
  26. arc_coords.matrix_tag=marix;
    9 j+ M, ~. V" P% S6 n/ N/ U
  27. UF_CURVE_create_arc(&arc_coords,&arc);& C- {8 h( j4 V/ b* E9 X. Z
  28. // create point - s9 D% C" o2 a7 H# K$ g
  29. double point_coords[3]={100,100,100};9 \0 u/ P3 c( `$ g) e9 M
  30. tag_t point;
    1 ?" u( Q9 s" q; E
  31. UF_CURVE_create_point(point_coords,&point);$ `% f5 X* S% s. }0 s& o8 C' r  a7 N

  32. 2 [% _4 Q" P9 G4 [
  33. // create Plane
    0 i# f7 N& c' r" `' j
  34. double    origin_point[3]={100,100,100};
    - g7 W/ K) r- D- S# ?
  35. double    plane_normal[3]={1,0,0};
    $ I/ \# S) U) X3 X" ]& F2 K
  36. tag_t     plane_tag;    ) G, N7 R- J; Y8 M
  37. UF_MODL_create_plane(origin_point,plane_normal,&plane_tag);</p><p> /*
    " \# G. B; l  i: E& H" l
  38. Get the curve information! m0 U; b8 z8 [+ \) H' N) L
  39.   */
    3 |4 p$ |' e9 Q+ z: n% v3 B- z
  40. UF_UI_open_listing_window();
    8 y3 p  B4 X+ O+ ~
  41. char msg[132];% c8 x% o% ?# G
  42. // get line information
    8 L8 s) J% v9 `; z/ ~- S
  43. UF_CURVE_line_t line_info;
    : O' @' l" d  i% L
  44. UF_CURVE_ask_line_data(line,&line_info);: Z8 M; {! }2 s8 h; C& r) Y
  45. sprintf(msg,"line coords:\n\t%lf,%lf,%lf;\n\t%lf,%lf,%lf",line_info.start_point[0],! S% s2 {* k6 G- \# {; M2 W
  46.   line_info.start_point[1],line_info.start_point[2],line_info.end_point[0],line_info.end_point[1],# F) D; V9 A# V, D8 d, @
  47.   line_info.end_point[2]);/ U' R; R1 I) f+ L9 T
  48. UF_UI_write_listing_window(msg);
    0 _  u; R3 s4 k5 \& R
  49. //get the point information4 {8 n0 X$ K. ~, N6 D
  50. double point_info[3];
    3 L5 [: Q5 t4 j3 L! w
  51. UF_CURVE_ask_point_data(point,point_info);
      E' a! f- T; p) ^4 L
  52. sprintf(msg,"\npoint coords:\n\t%lf,%lf,%lf",point_info[0],point_info[1],point_info[2]);
    7 E& L& g8 s8 M0 ^3 ]. c
  53. UF_UI_write_listing_window(msg);</p><p> //get the arc information7 q$ }5 s. `, F5 K% u) Q. M1 y
  54. UF_CURVE_arc_t arc_info;/ d! c9 T% v7 @- ]- Z! p
  55. UF_CURVE_ask_arc_data(arc,&arc_info);' \! |$ z  s! Z
  56. sprintf(msg,"\nArc Center coords:\n\t%lf,%lf,%lf;\nArc start Angle:\n\t%lf;\nArc End Angle:\n\t%lf;\nArc Radius:\n\t%lf;",$ W( @7 s% I* y, Z% c; V- S% l' S
  57.   arc_info.arc_center[0],arc_info.arc_center[1],arc_info.arc_center[2],
    4 B5 M$ e  Y$ T  e* `6 ]6 F2 r( L
  58.   arc_info.start_angle*RADEG,arc_info.end_angle*RADEG,arc_info.radius
    + s3 I9 h) u2 c9 |% h, |
  59.   );
    " c8 |1 c/ Z# V( e6 G1 x' R
  60. UF_UI_write_listing_window(msg);
    + u8 ~0 \5 M- {, p
  61. // calculate the arc length
    ( ~" o' h- N, A# s( v
  62. double arc_length;
    * t( v8 I$ k+ S) D% Y' P
  63. UF_CURVE_ask_arc_length(arc,0,1,UF_MODL_UNITS_PART,&arc_length);4 l2 C$ P/ }9 m0 ^0 a  N) b
  64. sprintf(msg,"\nArc Length:\n\t%lf",arc_length);. S* q/ t; @! Z! m* A! _" E
  65. UF_UI_write_listing_window(msg);
    4 v) {8 ]& l! @
  66. }
    4 p# G/ _6 J: ?0 U1 A& g
  67. </p><p> </p>
复制代码

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

使用道具 举报

发表回复

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

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

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

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

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

    我知道了