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

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

[复制链接]

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

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

admin 楼主

2013-11-4 12:06:33

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

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

x
NX二次开发源码分享:NXOpen C++创建圆柱体特征2 j% i, `; I  n+ z- \

  1. " g4 ~  }" b9 b' e) e! d
  2. <P> </P>
复制代码

  1. + _1 x# b9 O" b1 e' R& Y1 R
  2. <P>void CreateCylinder_UsingUDB::CreateCylinder()/ g" g7 g6 @8 c% A. V0 R
  3. {. B! \+ P. g' q! b. I& j# x
  4. Part* workPart(theSession->Parts()->Work());</P>. `+ Q  V9 M6 i1 x2 G( v$ x" P. p
  5. <P>Features::CylinderBuilder* cylinderBuilder1 = NULL;+ y: ?2 o- T4 z2 E( t9 i1 `4 b
  6. cylinderBuilder1 = workPart->Features()->CreateCylinderBuilder(NULL);</P>  c/ ~- |+ H' Q8 i' T
  7. <P>//Get the point1 g+ u( ^7 {  I$ `* l6 D
  8. PropertyList* pointPropertyList = point0->GetProperties();
    ( |- p# `5 v: S$ |# y5 @  `
  9. Point3d originPoint = pointPropertyList->GetPoint("Point");9 a# c% X( `8 O1 L- X
  10. delete pointPropertyList;
    ! }0 j2 Z/ q5 P: \" ^
  11. pointPropertyList = NULL;</P>. r; n' |4 |1 n8 R; U
  12. <P>//Get the direction% [0 s( M" Q* t1 j
  13. PropertyList* vectorPropertyList = vector0->GetProperties();
    ; O3 `2 A  l5 i7 k9 Z0 x: j7 Z
  14. Vector3d direction = vectorPropertyList->GetVector("Vector");0 M+ m1 _* X* f4 ^
  15. delete vectorPropertyList;
    $ y6 }" ?; _6 W
  16. vectorPropertyList = NULL;</P>
    5 x) W8 ]9 H" ~( h" ?& O
  17. <P>Direction* direction1 = NULL;
      }7 `8 [+ \# P$ t7 Y  ^/ b
  18. direction1 = workPart->Directions()->CreateDirection(originPoint, direction, SmartObject::UpdateOptionWithinModeling);</P>3 L& r3 n  w) e# e9 h. I" d
  19. <P>//Set diameter and height
    3 Z% v5 j3 k% D3 O3 }& O% Q
  20. std::stringstream diameterValue;7 k+ W5 L) ?0 N5 q2 D' c) C& `; B
  21. diameterValue << diameter->GetValue();$ y, D3 `/ E& i- X9 ~$ L! w
  22. std::stringstream heightValue;% S: e( m7 T' I! W7 ~* ~, }
  23. heightValue << height->GetValue();</P>
    9 T& Y+ v% J" y9 n
  24. <P>cylinderBuilder1->Diameter()->SetRightHandSide(diameterValue.str());
    - v% T) A) N0 @# k$ B% F; A- o
  25. cylinderBuilder1->Height()->SetRightHandSide(heightValue.str());</P>
    , L) r0 A; ]4 ~' W7 j
  26. <P>//Set the axis& i9 C. p- T" ]7 |  s% V. d
  27. Axis* axis1 = NULL;
    5 A0 u5 {% A0 \) ~
  28. axis1 = cylinderBuilder1->Axis();. I/ B" S4 m; d/ q+ O. m
  29. axis1->Point()->SeTCoordinates(originPoint);( U0 ]1 ~( |( c, O6 y5 T, U3 Z. Y
  30. axis1->SetDirection(direction1);</P>
    + _+ J$ ?& L4 l. _" P$ P" w" z( ]
  31. <P>//Commit7 [' Q+ u# V" s/ o* o+ N/ C- O
  32. cylinderBuilder1->Commit();- Q0 \: h5 V- l
  33. cylinderBuilder1->Destroy();
    6 L$ B5 [9 n9 m9 G* Q
  34. cylinderBuilder1 = NULL;, B8 Y1 O- E) M
  35. }* \' _! i0 |- H
  36. </P>
复制代码
& b, }) H6 ]2 V+ p) {  W
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了