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

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

[复制链接]

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

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

admin 楼主

2013-11-4 12:06:33

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

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

x
NX二次开发源码分享:NXOpen C++创建圆柱体特征' o- G: O- M0 M: {

  1. 2 \3 T, Y" D2 n' g9 H% j
  2. <P> </P>
复制代码

  1. 5 T6 d4 q$ l9 [+ [( |; K  n! |
  2. <P>void CreateCylinder_UsingUDB::CreateCylinder()
    2 e/ m0 ]8 y3 u7 B
  3. {
    ) O2 v. U; L3 p5 ?: ]2 W% R
  4. Part* workPart(theSession->Parts()->Work());</P>
    6 d7 y# t* f/ \: G
  5. <P>Features::CylinderBuilder* cylinderBuilder1 = NULL;8 |. _' d% [( W
  6. cylinderBuilder1 = workPart->Features()->CreateCylinderBuilder(NULL);</P>. \: U& D- ~# w0 y; l( |
  7. <P>//Get the point
    * A+ `& Y( I) q# N3 X9 G
  8. PropertyList* pointPropertyList = point0->GetProperties();
      ?+ g0 g" D! c- n: q* j4 G9 x
  9. Point3d originPoint = pointPropertyList->GetPoint("Point");" a! |# Q2 F5 P  s
  10. delete pointPropertyList;3 U# f& r4 K, _0 g3 K$ s+ `$ i
  11. pointPropertyList = NULL;</P>( x# C2 b4 O. I' {' r0 j0 q
  12. <P>//Get the direction$ p$ G; |# Y$ a! g2 s& O
  13. PropertyList* vectorPropertyList = vector0->GetProperties();' r: S# l! P) s: J9 D2 A
  14. Vector3d direction = vectorPropertyList->GetVector("Vector");
    5 V: {& l: p. B
  15. delete vectorPropertyList;! a  ~8 X+ H# s0 P/ p" y# }: _
  16. vectorPropertyList = NULL;</P>3 F) h* P, H! ~9 R# m8 D5 ]% G
  17. <P>Direction* direction1 = NULL;
    . S: e" }: {  D2 {# ~4 D& d
  18. direction1 = workPart->Directions()->CreateDirection(originPoint, direction, SmartObject::UpdateOptionWithinModeling);</P>
    1 t; l) l( }$ @
  19. <P>//Set diameter and height
    , r6 k7 [1 C! D6 e* \$ D
  20. std::stringstream diameterValue;
    / Y. K; K1 v1 c# W, n5 W* H
  21. diameterValue << diameter->GetValue();
    9 n; z0 h3 c9 p
  22. std::stringstream heightValue;
    - k: G) g0 Z( u" O: Z' _" ?
  23. heightValue << height->GetValue();</P>
    . ]( Q+ ^0 ?' \. S% x5 u2 \$ {
  24. <P>cylinderBuilder1->Diameter()->SetRightHandSide(diameterValue.str());
    + f" |9 H; }) T) O" k! p
  25. cylinderBuilder1->Height()->SetRightHandSide(heightValue.str());</P>
    , K0 D0 ^! l, |; D5 F' F
  26. <P>//Set the axis" f& X7 t0 a4 Z2 B
  27. Axis* axis1 = NULL;
    5 a6 z, Q. }5 |& ~% u5 h
  28. axis1 = cylinderBuilder1->Axis();3 ~* t6 [9 p; T
  29. axis1->Point()->SeTCoordinates(originPoint);2 ^9 D- Y, I+ O: b2 q1 u( w
  30. axis1->SetDirection(direction1);</P>% i$ k- c8 ]3 I4 O
  31. <P>//Commit
    9 s  W% H8 u* P$ S( K$ _1 l
  32. cylinderBuilder1->Commit();, _+ I+ j  M- I* Z2 C
  33. cylinderBuilder1->Destroy();
    3 y5 z7 |! M" ~& L: m+ q
  34. cylinderBuilder1 = NULL;/ \/ \8 M* t/ S
  35. }7 A% Z3 c/ @5 a" h
  36. </P>
复制代码
6 F0 E$ a) K/ a# A
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了