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

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

[复制链接]

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

admin 发表于 2013-11-4 12:06:33 |阅读模式

admin 楼主

2013-11-4 12:06:33

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

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

x
NX二次开发源码分享:NXOpen C++创建圆柱体特征
0 k1 k1 h! d+ Q' p+ s3 V
  1. 2 s+ d' O/ b9 D
  2. <P> </P>
复制代码
  1. 0 y8 M* ^( @, \; K+ e; \& i
  2. <P>void CreateCylinder_UsingUDB::CreateCylinder()' T2 ^* K! D+ n$ h0 T& Y
  3. {
    $ Q% x* `8 H/ J* L8 c9 O
  4. Part* workPart(theSession->Parts()->Work());</P>5 s7 T0 {6 ^( q& k/ J% n6 Q
  5. <P>Features::CylinderBuilder* cylinderBuilder1 = NULL;* S/ i& X+ G6 V  p, ]9 H2 Q
  6. cylinderBuilder1 = workPart->Features()->CreateCylinderBuilder(NULL);</P>
    0 f: q) S( N- \* V3 Q- W4 ?* O
  7. <P>//Get the point
    4 A' b8 \/ Y1 s8 l& R% g
  8. PropertyList* pointPropertyList = point0->GetProperties();
    ; T! {5 x% p6 L; S
  9. Point3d originPoint = pointPropertyList->GetPoint("Point");1 m6 q- y  U9 w/ V0 S: ]
  10. delete pointPropertyList;6 ]; Q1 O! E( X% G) B& B0 T
  11. pointPropertyList = NULL;</P>) M  I3 b+ B6 G/ I6 m
  12. <P>//Get the direction; L4 L5 G, @! A& u- z
  13. PropertyList* vectorPropertyList = vector0->GetProperties();" [* E3 E2 F0 z; R0 U3 O; t. |
  14. Vector3d direction = vectorPropertyList->GetVector("Vector");' o( @, d1 N, N' b2 N
  15. delete vectorPropertyList;0 ^) J' K$ T- v- {, Q2 F( w
  16. vectorPropertyList = NULL;</P>
    6 X2 W- f5 x7 m6 t2 ]2 N( j4 q
  17. <P>Direction* direction1 = NULL;
    1 O  N1 i6 l, n* ?. @
  18. direction1 = workPart->Directions()->CreateDirection(originPoint, direction, SmartObject::UpdateOptionWithinModeling);</P>
    / m+ @& J# f2 E9 B4 _" n  V
  19. <P>//Set diameter and height
    & y3 y% W; ~0 _$ P# l, B9 X  X
  20. std::stringstream diameterValue;& D; P4 M8 O8 g* k5 K) T% N4 Q
  21. diameterValue << diameter->GetValue();
    * c4 o* A2 C( |& d4 J
  22. std::stringstream heightValue;% J+ \* e, `6 V# y
  23. heightValue << height->GetValue();</P>
      J: [4 d( O) t+ J- X
  24. <P>cylinderBuilder1->Diameter()->SetRightHandSide(diameterValue.str());
    3 r& z/ M, E& B% }4 i0 F9 H
  25. cylinderBuilder1->Height()->SetRightHandSide(heightValue.str());</P>! t# |7 _3 M# E; V# I
  26. <P>//Set the axis
    2 a: w. Z8 [4 p
  27. Axis* axis1 = NULL;
    7 Z6 w# g( Z- Q- }3 |& W/ U( \
  28. axis1 = cylinderBuilder1->Axis();
    * d4 g% [9 G# D+ b9 F+ g8 W
  29. axis1->Point()->SeTCoordinates(originPoint);( S( H5 v5 s% X" V
  30. axis1->SetDirection(direction1);</P>
    ' Q6 X' A6 y5 v0 H( [* q
  31. <P>//Commit( K! j% g& u- O3 r
  32. cylinderBuilder1->Commit();
    / w. v# W; S- A  K# z  D3 c
  33. cylinderBuilder1->Destroy();
    7 }+ E  p: T0 t9 G
  34. cylinderBuilder1 = NULL;
    ! R  \0 d' T9 q+ t) U5 R1 e# y
  35. }
    2 s: M( o2 [* A# J+ H
  36. </P>
复制代码

* X, |0 R( N, h" Q! P3 Y  ]) f2 m
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了