PLM之家PLMHome-工业软件践行者

[二次开发源码] NX二次开发源码分享:NXOpen C++创建圆柱体特征

[复制链接]

2013-11-4 12:06:33 3985 0

2470

主题

1275

回帖

8万

积分

管理员

PLM之家站长

积分
82162
QQ
发表于 2013-11-4 12:06:33 | 显示全部楼层 |阅读模式

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

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

x
NX二次开发源码分享:NXOpen C++创建圆柱体特征7 ]* H! e/ D2 M& B6 r  u( m
  1.   h3 Q* o1 f' W5 a% G  p
  2. <P> </P>
复制代码

  1.   z* t# |' H) V0 u4 I( V$ h" N
  2. <P>void CreateCylinder_UsingUDB::CreateCylinder()1 ], t9 s# E' e, x% s( N
  3. {/ ]2 {: @4 @, I+ z0 h
  4. Part* workPart(theSession->Parts()->Work());</P>5 u% \# o* R4 m# l
  5. <P>Features::CylinderBuilder* cylinderBuilder1 = NULL;
    ! n+ }% X6 z3 D4 d. Q; C9 G4 X
  6. cylinderBuilder1 = workPart->Features()->CreateCylinderBuilder(NULL);</P>9 L0 o% u2 s+ q( }9 k# }6 T3 [
  7. <P>//Get the point
    : _$ P, G2 d/ b/ f; Y- ]
  8. PropertyList* pointPropertyList = point0->GetProperties();
    3 [$ g+ Q, Y- g% C9 S# ~' q% B8 D2 ?; ^
  9. Point3d originPoint = pointPropertyList->GetPoint("Point");
    1 x0 t: P) U7 Q( Y5 ]& l, A
  10. delete pointPropertyList;
    4 w* f8 s' L& ?7 V: D8 p
  11. pointPropertyList = NULL;</P>2 C* J5 c0 J: ^1 ~2 X6 I9 P) J( @2 k
  12. <P>//Get the direction
    5 i1 c) Z) J8 o& }
  13. PropertyList* vectorPropertyList = vector0->GetProperties();( h5 T; t: Y5 K  u  f/ L
  14. Vector3d direction = vectorPropertyList->GetVector("Vector");( }, F1 `4 X5 h5 E1 ~0 u
  15. delete vectorPropertyList;6 C1 w& V, h+ y" u; M) ~$ p
  16. vectorPropertyList = NULL;</P>
    . A( |+ ^) ~7 H6 ]: ]2 ^  j# P
  17. <P>Direction* direction1 = NULL;
    6 B( Q5 r% [$ w8 k% j8 \# |
  18. direction1 = workPart->Directions()->CreateDirection(originPoint, direction, SmartObject::UpdateOptionWithinModeling);</P>
    0 Q7 c2 n& [) I7 B9 O9 G6 o; Q) D
  19. <P>//Set diameter and height
    $ w6 V6 ^1 ?& ~; i
  20. std::stringstream diameterValue;  p+ X$ F. r1 T9 C& g
  21. diameterValue << diameter->GetValue();
    ' F6 o) x) y) e1 [
  22. std::stringstream heightValue;# g/ s  S( ?& H1 z% Q
  23. heightValue << height->GetValue();</P>
    ! x( U: ~) ?; L! D+ H$ a! y. S! T. [
  24. <P>cylinderBuilder1->Diameter()->SetRightHandSide(diameterValue.str());! q% b; S. ]1 _" p: }
  25. cylinderBuilder1->Height()->SetRightHandSide(heightValue.str());</P>
    " _% ]6 R% q6 L
  26. <P>//Set the axis+ j# {+ o) i6 B* _: u
  27. Axis* axis1 = NULL;+ y% {# Y6 r4 K' L; P( q! b2 H
  28. axis1 = cylinderBuilder1->Axis();7 w' g2 e' p9 F0 ~5 Z# ]4 y& @
  29. axis1->Point()->SeTCoordinates(originPoint);" a3 W. o+ p. _6 V- x5 w+ `. J
  30. axis1->SetDirection(direction1);</P>
    ( u1 b' @( ~) m1 h1 ~
  31. <P>//Commit
    + s8 J4 Q1 |* l' m; W
  32. cylinderBuilder1->Commit();+ ?9 h- D" C0 I. M, |% ?! y
  33. cylinderBuilder1->Destroy();& W7 p) H% J& L, m
  34. cylinderBuilder1 = NULL;
    ) a; b) T# Z3 E: j1 ^3 t
  35. }
    4 ^8 L( y, K1 e4 ~& j5 G# |+ b
  36. </P>
复制代码

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

使用道具 举报

发表回复

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

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

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

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

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

    我知道了