PLM之家PLMHome-工业软件与AI结合践行者

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

[复制链接]

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

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

admin 楼主

2013-11-4 12:06:33

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

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

x
NX二次开发源码分享:NXOpen C++创建圆柱体特征
) x0 }' D- |! `. ?* |

  1. / m' N; n* ~, J5 D  n
  2. <P> </P>
复制代码
  1. 0 o5 R6 u; k7 K; D" L* ^
  2. <P>void CreateCylinder_UsingUDB::CreateCylinder()  v5 K1 o) h! [9 A
  3. {" X4 _& m+ g: J* G" r% a
  4. Part* workPart(theSession->Parts()->Work());</P>5 \8 w9 ?) D7 l/ N8 k7 f1 U- X
  5. <P>Features::CylinderBuilder* cylinderBuilder1 = NULL;6 ?" P( n  F# i* y* E
  6. cylinderBuilder1 = workPart->Features()->CreateCylinderBuilder(NULL);</P>$ R- c9 g" Z* `, V0 ]9 i, i/ b  w" ~$ Z
  7. <P>//Get the point4 s; m; @3 G$ C5 ~
  8. PropertyList* pointPropertyList = point0->GetProperties();
    2 Q' k* e- p) p2 C- K$ j  B' ?# g4 Q
  9. Point3d originPoint = pointPropertyList->GetPoint("Point");
    4 _9 n+ I' X' ?; A( `6 w$ X/ p& t- J
  10. delete pointPropertyList;5 l, s) K1 s4 L
  11. pointPropertyList = NULL;</P>! A& V1 L7 O9 N( o* E, {
  12. <P>//Get the direction
      U- X) h0 R# q) O5 H! @
  13. PropertyList* vectorPropertyList = vector0->GetProperties();
    : p) c5 Z2 F8 a! _
  14. Vector3d direction = vectorPropertyList->GetVector("Vector");
    6 Z0 e; Y7 z+ {
  15. delete vectorPropertyList;
    7 c3 |! J, t) o9 s# P
  16. vectorPropertyList = NULL;</P>
    ! h5 L  S! `  M- e- [7 `
  17. <P>Direction* direction1 = NULL;  X+ c& p4 k" Y
  18. direction1 = workPart->Directions()->CreateDirection(originPoint, direction, SmartObject::UpdateOptionWithinModeling);</P>+ ^/ C% P. R! `$ C$ \
  19. <P>//Set diameter and height8 ]; I0 p7 K4 A. @
  20. std::stringstream diameterValue;) @5 y0 ^# W' z7 ?' X. u- r
  21. diameterValue << diameter->GetValue();
    - n' O1 @: \. Y
  22. std::stringstream heightValue;) N) v7 v  F0 Z% W( M* Z# z$ A
  23. heightValue << height->GetValue();</P>
    1 \, e0 |: o+ k$ ~! T
  24. <P>cylinderBuilder1->Diameter()->SetRightHandSide(diameterValue.str());) n3 o8 f0 c; M( r" t' u0 b: |6 f$ b
  25. cylinderBuilder1->Height()->SetRightHandSide(heightValue.str());</P>9 Z6 e- p$ x- u, I; Q2 I
  26. <P>//Set the axis( m- x& E# s6 B- i
  27. Axis* axis1 = NULL;) ]) j; U  ~! w# n, Q/ k
  28. axis1 = cylinderBuilder1->Axis();
    . R) I' V( i) Q# X. \
  29. axis1->Point()->SeTCoordinates(originPoint);
    : W/ I$ t& ?' G8 k* Y$ g
  30. axis1->SetDirection(direction1);</P>* i  c+ v8 y1 i( s! x* H
  31. <P>//Commit
    & K' n" R% |5 Q0 s
  32. cylinderBuilder1->Commit();0 @* K! X; A% A# N. J4 Y# G
  33. cylinderBuilder1->Destroy();' L" w. N( \7 P+ l0 i' |" N! d
  34. cylinderBuilder1 = NULL;
    1 [7 \. A1 f- t8 s! j! z
  35. }
    " i8 |  k' [# s3 b
  36. </P>
复制代码

2 r( L1 N/ P, j% V+ z* 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二次开发专题模块培训报名开始啦

    我知道了