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

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

[复制链接]

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

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

admin 楼主

2013-11-4 12:06:33

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

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

x
NX二次开发源码分享:NXOpen C++创建圆柱体特征- k+ P9 J$ M7 R$ p2 o) `

  1. # ?: y( Q* h6 F3 L' k1 A
  2. <P> </P>
复制代码
  1. 4 t, i8 i1 a; T* @
  2. <P>void CreateCylinder_UsingUDB::CreateCylinder()7 b# B% n" Q- A9 T3 F
  3. {
    5 P, a; h/ s+ K% w; C+ I
  4. Part* workPart(theSession->Parts()->Work());</P>% h1 R, B4 r; A( u$ ~+ I
  5. <P>Features::CylinderBuilder* cylinderBuilder1 = NULL;6 {& @0 M0 U+ d
  6. cylinderBuilder1 = workPart->Features()->CreateCylinderBuilder(NULL);</P>4 p1 T3 ]3 }8 k9 u
  7. <P>//Get the point
    + V5 z: O! G; l+ B/ ]$ i$ W( `# F' ?
  8. PropertyList* pointPropertyList = point0->GetProperties();
    8 \( k* \/ h8 J9 t5 I. U2 e& p( _1 n$ L
  9. Point3d originPoint = pointPropertyList->GetPoint("Point");
    1 j; @! H# o7 j7 P2 q4 \
  10. delete pointPropertyList;
    6 ~1 q! l9 b& G, D) c
  11. pointPropertyList = NULL;</P>- D6 G; X9 Q2 n0 y, q" v/ W) C
  12. <P>//Get the direction
    ; ~/ V& V" y4 Z$ e8 a+ K
  13. PropertyList* vectorPropertyList = vector0->GetProperties();
      D: c% r* g$ a5 v/ y8 `
  14. Vector3d direction = vectorPropertyList->GetVector("Vector");' v! D% e8 F$ R1 Z$ r% T
  15. delete vectorPropertyList;
    " k/ x7 v% {/ j
  16. vectorPropertyList = NULL;</P>& d/ w! S" P( I, X* l
  17. <P>Direction* direction1 = NULL;3 h# }" ^5 ?5 }: Q+ r2 b7 j
  18. direction1 = workPart->Directions()->CreateDirection(originPoint, direction, SmartObject::UpdateOptionWithinModeling);</P>
    8 @; _- l' K3 Q3 ^6 o
  19. <P>//Set diameter and height* V7 H6 x+ N. }$ ]2 ^9 P" O* v
  20. std::stringstream diameterValue;
    - f4 }- {2 b% x' g/ m
  21. diameterValue << diameter->GetValue();4 t' }" ~5 r3 @1 K; U6 {
  22. std::stringstream heightValue;+ n: V& m- p3 f! A
  23. heightValue << height->GetValue();</P>5 I" K1 s6 M) [8 x6 i4 G+ Q
  24. <P>cylinderBuilder1->Diameter()->SetRightHandSide(diameterValue.str());
    9 d# r$ d- f$ }. a
  25. cylinderBuilder1->Height()->SetRightHandSide(heightValue.str());</P>5 T0 x! v+ J% G' D7 I! F! Q
  26. <P>//Set the axis
    + ?8 C/ x+ b/ S/ z8 O4 i
  27. Axis* axis1 = NULL;+ J4 Z* G* r- M& A1 U
  28. axis1 = cylinderBuilder1->Axis();
    % v) ^9 {/ ?* g3 j, L5 Q
  29. axis1->Point()->SeTCoordinates(originPoint);' |% Q( W/ p( S5 A7 k2 v) v
  30. axis1->SetDirection(direction1);</P>
    ' `. @# g! f8 I9 t  T$ U8 x
  31. <P>//Commit
    & S& L) q6 v# c8 g
  32. cylinderBuilder1->Commit();" ]. t$ u: L; G9 I
  33. cylinderBuilder1->Destroy();
    4 |9 ]& l$ }; |! V' c; c
  34. cylinderBuilder1 = NULL;$ d' Y4 u! O" a
  35. }: s3 v' d1 T( g7 l" r  F
  36. </P>
复制代码
. K" B9 w2 m6 j! N) G; ]8 N  \
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了