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

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

[复制链接]

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

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

admin 楼主

2013-11-4 12:06:33

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

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

x
NX二次开发源码分享:NXOpen C++创建圆柱体特征4 C- X& X3 I( H5 e

  1. 2 s* ], E& j" _1 H: k
  2. <P> </P>
复制代码

  1. 8 L: b7 ?7 q8 @$ U
  2. <P>void CreateCylinder_UsingUDB::CreateCylinder()5 g9 e- v. g9 b0 h) p
  3. {+ h8 F9 J% T" r. Q
  4. Part* workPart(theSession->Parts()->Work());</P>& D; x# ~8 ?, k
  5. <P>Features::CylinderBuilder* cylinderBuilder1 = NULL;: l9 U* T  B1 E
  6. cylinderBuilder1 = workPart->Features()->CreateCylinderBuilder(NULL);</P>7 ]$ p3 ?. o! R, e! ]& O0 P8 J
  7. <P>//Get the point
    % W7 G; q- ^6 q4 a8 M
  8. PropertyList* pointPropertyList = point0->GetProperties();
    : \' U3 N2 d# O3 V6 d
  9. Point3d originPoint = pointPropertyList->GetPoint("Point");
    / ^/ T9 A1 E! J
  10. delete pointPropertyList;
    * v- J) {% n8 |1 t- `! i4 V
  11. pointPropertyList = NULL;</P>6 ~' }" N! ]3 i( y  f: i
  12. <P>//Get the direction* `- m0 [. P: L5 L# j1 ]* {
  13. PropertyList* vectorPropertyList = vector0->GetProperties();
    ) O) b, R: L4 S$ _/ P! _6 u
  14. Vector3d direction = vectorPropertyList->GetVector("Vector");1 F. F3 Q$ o* Q
  15. delete vectorPropertyList;) [* t. F. t2 W0 g0 d4 l0 Q
  16. vectorPropertyList = NULL;</P># i7 E5 s: V3 }( j6 }
  17. <P>Direction* direction1 = NULL;
    4 ~3 L6 ~% Q" H; |0 A8 ~  x% D
  18. direction1 = workPart->Directions()->CreateDirection(originPoint, direction, SmartObject::UpdateOptionWithinModeling);</P>
    ) A3 N8 V1 x# `0 P/ W+ E" K
  19. <P>//Set diameter and height
    ; R) h& E4 R" B( t
  20. std::stringstream diameterValue;, u' v+ v1 C% N* K% \3 u
  21. diameterValue << diameter->GetValue();* b3 J7 A) e' h1 G3 y- \
  22. std::stringstream heightValue;9 z' L4 T* _& S# w$ r
  23. heightValue << height->GetValue();</P>
    * K6 T  ^7 J/ r7 S4 f
  24. <P>cylinderBuilder1->Diameter()->SetRightHandSide(diameterValue.str());
    , k& O# O1 l1 [$ }
  25. cylinderBuilder1->Height()->SetRightHandSide(heightValue.str());</P>: f' v/ M& G0 O! Y2 q; S
  26. <P>//Set the axis/ }3 X, I+ r) S
  27. Axis* axis1 = NULL;( ~$ c4 H- B% c' ]
  28. axis1 = cylinderBuilder1->Axis();5 h( Q$ h% J2 I, M+ r6 z5 h
  29. axis1->Point()->SeTCoordinates(originPoint);0 A* Z- u1 |3 u' P( J
  30. axis1->SetDirection(direction1);</P>
    ( ?! Z  s) c; B3 {- K" c% {
  31. <P>//Commit
    1 l/ C# i  U0 \, }
  32. cylinderBuilder1->Commit();
    ) {% R& a4 O* _  t% v7 A: l, d
  33. cylinderBuilder1->Destroy();: |+ V5 O. m2 ~4 v! d7 Z% Z- m
  34. cylinderBuilder1 = NULL;  j# p: S' T2 s, U( h) k
  35. }  ?3 |3 F: M3 |3 A' `
  36. </P>
复制代码
, ^9 o& W1 M# z, g
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了