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

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

[复制链接]

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

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

admin 楼主

2013-11-4 12:06:33

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

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

x
NX二次开发源码分享:NXOpen C++创建圆柱体特征
- w% t. D- s( W4 Z
  1. ; ~& I: U+ H5 e4 O# V' R
  2. <P> </P>
复制代码
  1. ! E) t1 d* e8 f4 k% A: Z
  2. <P>void CreateCylinder_UsingUDB::CreateCylinder()9 n% z* w* `9 J- v/ P" x  `
  3. {6 e! M* E& D- ?6 r! y
  4. Part* workPart(theSession->Parts()->Work());</P>9 b4 J1 U9 G' h' u' L1 P8 B
  5. <P>Features::CylinderBuilder* cylinderBuilder1 = NULL;
    3 d5 F" f' s5 u# c% y, c7 I
  6. cylinderBuilder1 = workPart->Features()->CreateCylinderBuilder(NULL);</P>' T8 i- k7 b% w& O0 r; M
  7. <P>//Get the point
    " H4 W' s1 D; T4 }" H
  8. PropertyList* pointPropertyList = point0->GetProperties();
    # A( B  m: ~' K3 K
  9. Point3d originPoint = pointPropertyList->GetPoint("Point");
    7 Y3 y" x; n; ^, O9 S
  10. delete pointPropertyList;/ |# Z" v9 O) z( B9 Z9 ^4 r$ i6 a: }) f  `
  11. pointPropertyList = NULL;</P>( u6 d' r3 C0 U
  12. <P>//Get the direction
    ! `$ k5 V, k3 t# \: L
  13. PropertyList* vectorPropertyList = vector0->GetProperties();0 Q: a! P! T& M, d# F
  14. Vector3d direction = vectorPropertyList->GetVector("Vector");
    3 r8 Y/ g0 w1 \7 x6 R
  15. delete vectorPropertyList;$ M: j5 i1 M$ V" P- ^8 l) Q( ^
  16. vectorPropertyList = NULL;</P>3 j, \6 [( Z( m! d9 v6 _- A) \7 Y
  17. <P>Direction* direction1 = NULL;
    - {3 b5 \8 O/ @1 K
  18. direction1 = workPart->Directions()->CreateDirection(originPoint, direction, SmartObject::UpdateOptionWithinModeling);</P>
    . ^$ V% i3 [, |- x6 |' {& D
  19. <P>//Set diameter and height
    " c4 C# z) [$ z8 _( y
  20. std::stringstream diameterValue;
    $ T6 u) D1 m$ p8 n) z0 ]: D5 F: ?! G
  21. diameterValue << diameter->GetValue();
    8 Y' Z( ~) @9 r7 |1 {+ ?
  22. std::stringstream heightValue;
    2 k/ F4 R, k6 [7 M$ v+ A
  23. heightValue << height->GetValue();</P>
    1 |# i1 W3 P4 I
  24. <P>cylinderBuilder1->Diameter()->SetRightHandSide(diameterValue.str());
    + H+ C+ a* H. x2 `- U3 W: r
  25. cylinderBuilder1->Height()->SetRightHandSide(heightValue.str());</P>5 F3 _" U1 e. u% u1 \9 p( g- C
  26. <P>//Set the axis
    , k/ d& E! H5 z% B& }6 E# N0 n
  27. Axis* axis1 = NULL;
    6 M' C( c- G4 C" }
  28. axis1 = cylinderBuilder1->Axis();& k2 m$ `" L: \" I1 K
  29. axis1->Point()->SeTCoordinates(originPoint);
    4 z5 `& Z' P$ P+ Q
  30. axis1->SetDirection(direction1);</P># ?- \' _% u" R5 q! T0 @
  31. <P>//Commit2 c; [' T# N' d/ I. u" }" S
  32. cylinderBuilder1->Commit();
    8 v' e' R% ?4 c1 P
  33. cylinderBuilder1->Destroy();3 Q2 [7 O) L& r. x& S+ @0 `
  34. cylinderBuilder1 = NULL;" T! N+ k% i* n6 v, j3 I; t
  35. }/ U5 a# `$ Q9 h, U7 `
  36. </P>
复制代码
  X% w5 [- z/ i  E( j" [) Z
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了