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

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

[复制链接]

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

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

admin 楼主

2013-11-4 12:06:33

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

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

x
NX二次开发源码分享:NXOpen C++创建圆柱体特征
) o% I6 S+ l. O% _/ i* p  ?0 z
  1. ! k0 x; p  _# K: n9 j3 p0 p
  2. <P> </P>
复制代码
  1. 5 P% U, L( j# N7 y
  2. <P>void CreateCylinder_UsingUDB::CreateCylinder()
      X! H) R% l: q( |; N+ D
  3. {! C# w: k2 B$ Y! X' G& u9 q
  4. Part* workPart(theSession->Parts()->Work());</P>
    - L6 |9 w& Y. B6 j& N, M
  5. <P>Features::CylinderBuilder* cylinderBuilder1 = NULL;
    4 i2 u+ C6 r% k5 c. O
  6. cylinderBuilder1 = workPart->Features()->CreateCylinderBuilder(NULL);</P>* |# ?& h: Y6 _. f* \; h
  7. <P>//Get the point
    ! U) j: ^. \! k; P4 p% }4 q+ T# ?
  8. PropertyList* pointPropertyList = point0->GetProperties();
    ( M6 C6 q" Z, z& c. G
  9. Point3d originPoint = pointPropertyList->GetPoint("Point");5 e6 o  n! K* O
  10. delete pointPropertyList;
    # c8 F% B! `- Y- _
  11. pointPropertyList = NULL;</P>
    - e* J1 E$ ^; j' u8 t
  12. <P>//Get the direction
    0 u. M  t# ~8 ]8 E: W) I% E" u
  13. PropertyList* vectorPropertyList = vector0->GetProperties();
    8 R" C* w$ ^, L* \6 s
  14. Vector3d direction = vectorPropertyList->GetVector("Vector");
    5 o$ k- O% L8 K$ W/ j9 b
  15. delete vectorPropertyList;
    - _# `" u4 J1 Z- z. d2 b
  16. vectorPropertyList = NULL;</P>" K9 `0 Q% E( p+ K, b/ d
  17. <P>Direction* direction1 = NULL;
    ( T  h7 q8 x% Q% w) g- a$ N
  18. direction1 = workPart->Directions()->CreateDirection(originPoint, direction, SmartObject::UpdateOptionWithinModeling);</P>
    2 n/ I/ u. _. _
  19. <P>//Set diameter and height) ^; u$ B$ W' A, `2 J+ C( p7 U
  20. std::stringstream diameterValue;
    + w  r$ w/ c% t0 p* g) \
  21. diameterValue << diameter->GetValue();
    ! t+ W: [0 C- l1 `, \
  22. std::stringstream heightValue;7 Q! E  r) J; R% O. |
  23. heightValue << height->GetValue();</P>
    3 G* d( s/ B1 g
  24. <P>cylinderBuilder1->Diameter()->SetRightHandSide(diameterValue.str());
    ' W1 a5 J+ Y0 g1 F& w
  25. cylinderBuilder1->Height()->SetRightHandSide(heightValue.str());</P>
    & ?& |8 W1 [, `4 o
  26. <P>//Set the axis! \7 g) F' d( V& X6 w/ S- H$ S  Y6 H
  27. Axis* axis1 = NULL;
    : m3 e1 \7 a  m  S  ]
  28. axis1 = cylinderBuilder1->Axis();
    & L: Y" A. h  g; G0 l) M) A! Y
  29. axis1->Point()->SeTCoordinates(originPoint);3 z4 s0 y! g1 |& T$ n/ K
  30. axis1->SetDirection(direction1);</P>! L# V7 T2 m9 ?; S0 X5 R% ?
  31. <P>//Commit9 `2 Z0 u  i7 N9 Z0 c. p" h
  32. cylinderBuilder1->Commit();
    9 ~1 H- N5 h6 Y
  33. cylinderBuilder1->Destroy();1 K6 `1 B+ \! c1 P* x; t
  34. cylinderBuilder1 = NULL;- Q( z7 M5 H$ X( P
  35. }
    0 ^4 O% a8 |7 h+ l( [  q/ M
  36. </P>
复制代码
. ^4 @4 _* Z* D+ C0 l5 K
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了