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

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

[复制链接]

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

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

admin 楼主

2013-11-4 12:06:33

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

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

x
NX二次开发源码分享:NXOpen C++创建圆柱体特征
. ]4 A2 n% x+ O9 s3 j2 l: n

  1. - o* W" w, c$ I, G: I
  2. <P> </P>
复制代码
  1. : E3 v- [6 W: C% W$ z
  2. <P>void CreateCylinder_UsingUDB::CreateCylinder()
    ' h/ E, A4 R* Y/ w5 I
  3. {
    4 x! r' b/ R8 s* D
  4. Part* workPart(theSession->Parts()->Work());</P>
    - T, H4 x% V! k5 c8 D, i' t' l3 A
  5. <P>Features::CylinderBuilder* cylinderBuilder1 = NULL;
    7 u2 z3 |; o4 z% ?8 q
  6. cylinderBuilder1 = workPart->Features()->CreateCylinderBuilder(NULL);</P>4 ?, Q8 y; P0 |% w& B
  7. <P>//Get the point- m4 w: F) |% _
  8. PropertyList* pointPropertyList = point0->GetProperties();! B& n& m+ Z" }
  9. Point3d originPoint = pointPropertyList->GetPoint("Point");* t/ ~( z: d+ b2 b
  10. delete pointPropertyList;
    6 R7 i) t0 N/ b
  11. pointPropertyList = NULL;</P>
    5 q5 q8 h( t6 H# ^
  12. <P>//Get the direction& ^' z  N; J+ {9 d9 r- Z2 V* U
  13. PropertyList* vectorPropertyList = vector0->GetProperties();
    ) v+ _& t" s! o9 }7 O
  14. Vector3d direction = vectorPropertyList->GetVector("Vector");
    8 M2 r% \! o% W/ h, E" n
  15. delete vectorPropertyList;1 |' d# k. G: Z+ X6 ]
  16. vectorPropertyList = NULL;</P>3 g9 J5 j0 M5 C/ e2 k
  17. <P>Direction* direction1 = NULL;9 a2 v; T4 [- h, t+ y
  18. direction1 = workPart->Directions()->CreateDirection(originPoint, direction, SmartObject::UpdateOptionWithinModeling);</P>* h7 Z; K/ [: I( R- }7 v4 J$ ]
  19. <P>//Set diameter and height7 [: G& [$ W8 f( ?
  20. std::stringstream diameterValue;
    : M, E) t1 B# P% C8 D3 f8 d
  21. diameterValue << diameter->GetValue();$ z5 k! S! g9 a; S- w  {
  22. std::stringstream heightValue;
    4 ?+ f8 \2 F+ b7 F; I
  23. heightValue << height->GetValue();</P>
    2 b* J, |- N. S# \; a6 r: B5 p4 D* N
  24. <P>cylinderBuilder1->Diameter()->SetRightHandSide(diameterValue.str());
    $ [2 ~: ^5 B+ m$ y, c
  25. cylinderBuilder1->Height()->SetRightHandSide(heightValue.str());</P>
    % s, `) ~/ F! ^4 Z# v8 {
  26. <P>//Set the axis; b$ H; {, m' z0 p
  27. Axis* axis1 = NULL;: y! `) Q( Q5 K' H3 x; }( Y
  28. axis1 = cylinderBuilder1->Axis();5 Z" K7 Q+ s" S9 N
  29. axis1->Point()->SeTCoordinates(originPoint);" ~- Z2 }) P" c$ v. U. i: A) c
  30. axis1->SetDirection(direction1);</P>
    7 W: x; k) c' ]
  31. <P>//Commit
    + b0 M* V: N6 v# ]* X5 S4 e0 @
  32. cylinderBuilder1->Commit();
    ! w# f+ P0 G- [
  33. cylinderBuilder1->Destroy();) N" s$ j4 X# P
  34. cylinderBuilder1 = NULL;
    * k: |- C, u8 y8 @8 O+ h
  35. }
    & m3 E9 o; |2 D  D5 {
  36. </P>
复制代码
! ]  d6 [4 M% p7 c
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了