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

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

[复制链接]

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

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

admin 楼主

2013-11-4 12:06:33

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

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

x
NX二次开发源码分享:NXOpen C++创建圆柱体特征9 E+ V: z! M( c! U/ g* U
  1. & Q  d1 N! e' L' [
  2. <P> </P>
复制代码
  1. 9 ]: y- L0 ?' R. b& j
  2. <P>void CreateCylinder_UsingUDB::CreateCylinder()$ C2 l( z& I% Q; k: F- w! K
  3. {# x3 z+ T1 ~1 m- g( `& U- M9 G. A
  4. Part* workPart(theSession->Parts()->Work());</P>  N- R' [; A  ]3 G; ?% I
  5. <P>Features::CylinderBuilder* cylinderBuilder1 = NULL;
    + \0 }2 a; v" j; s. u- _
  6. cylinderBuilder1 = workPart->Features()->CreateCylinderBuilder(NULL);</P>% S4 V9 ~- }& v& r$ @7 t. N9 L8 Z
  7. <P>//Get the point, o9 B" G! ?& }  M
  8. PropertyList* pointPropertyList = point0->GetProperties();
    3 d) S1 {& D. N& }4 D: }' F$ P
  9. Point3d originPoint = pointPropertyList->GetPoint("Point");. k0 F& F5 U& r* Y; j' ?& w
  10. delete pointPropertyList;  X6 u" n# ?2 b% r
  11. pointPropertyList = NULL;</P>
    ) A8 ~, t  Q! X0 R. t  M+ X
  12. <P>//Get the direction
    7 J2 s8 H" C$ ]6 y9 \
  13. PropertyList* vectorPropertyList = vector0->GetProperties();
    # F. M6 a1 b: W- v
  14. Vector3d direction = vectorPropertyList->GetVector("Vector");
    ' }+ t( b5 {* ]1 ~
  15. delete vectorPropertyList;' v  M) E* C8 ]$ Q
  16. vectorPropertyList = NULL;</P>9 U) }8 D) ~  j4 a2 X
  17. <P>Direction* direction1 = NULL;7 t; N5 V, A- `+ B8 b3 T$ X$ f8 F
  18. direction1 = workPart->Directions()->CreateDirection(originPoint, direction, SmartObject::UpdateOptionWithinModeling);</P>
    2 ^. @5 {: Q2 K; i) p  D. g
  19. <P>//Set diameter and height5 _  o# @3 p% d- V% u
  20. std::stringstream diameterValue;
    . L1 Y2 K7 r: F7 ^$ f9 X
  21. diameterValue << diameter->GetValue();
    ' l4 p8 R+ W2 y  r
  22. std::stringstream heightValue;+ m5 H1 A: N  A( |& a8 V# O
  23. heightValue << height->GetValue();</P>
    2 W0 p5 F, \# ^. E
  24. <P>cylinderBuilder1->Diameter()->SetRightHandSide(diameterValue.str());
    " M& ^4 h4 t, n; }( i8 h
  25. cylinderBuilder1->Height()->SetRightHandSide(heightValue.str());</P>
    3 ^9 T/ G8 f2 B; q
  26. <P>//Set the axis
    " t: Y; Q, a9 S# J* g# c
  27. Axis* axis1 = NULL;8 [3 o( y* D* X. F- j( y
  28. axis1 = cylinderBuilder1->Axis();
    , [. b$ e) E0 E, ]
  29. axis1->Point()->SeTCoordinates(originPoint);
    6 m3 b: F  j# T; C- z. D& r
  30. axis1->SetDirection(direction1);</P>3 {* i) v1 W( a( K) D
  31. <P>//Commit5 c' E3 x$ R- _* F0 f' \2 K
  32. cylinderBuilder1->Commit();% l0 u* O+ b" S: @6 U  `, A
  33. cylinderBuilder1->Destroy();
    - G! \$ f! J" p4 K$ {% B% l- x
  34. cylinderBuilder1 = NULL;( E1 R7 R4 N' C
  35. }% Z& t4 s" S* m
  36. </P>
复制代码
0 M; ~& \% c) z8 A. z4 L& K) d
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了