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

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

[复制链接]

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

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

admin 楼主

2013-11-4 12:06:33

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

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

x
NX二次开发源码分享:NXOpen C++创建圆柱体特征# x6 E4 f- s9 w- ?

  1. / W# x9 n( D0 ~( g
  2. <P> </P>
复制代码

  1. 0 |% h( Q! o# T# x/ l
  2. <P>void CreateCylinder_UsingUDB::CreateCylinder()
    # B. ]  b8 t) a1 [/ o
  3. {, x) H5 K5 [' Z" e- N# @
  4. Part* workPart(theSession->Parts()->Work());</P>
    3 \3 N4 Q; q& a$ Z# G
  5. <P>Features::CylinderBuilder* cylinderBuilder1 = NULL;
    & p- G) w2 V# U
  6. cylinderBuilder1 = workPart->Features()->CreateCylinderBuilder(NULL);</P>9 Q$ N# K3 P- n1 J
  7. <P>//Get the point  Q( q: j7 K& U( j/ l' T& i+ S
  8. PropertyList* pointPropertyList = point0->GetProperties();
    9 ?' m' y9 n0 b" A( Q! k+ @+ G
  9. Point3d originPoint = pointPropertyList->GetPoint("Point");/ r8 r2 ]8 J4 T% ^+ ~( n" Z' o
  10. delete pointPropertyList;
    & P- W+ G& X" C& [; i. A7 H5 I
  11. pointPropertyList = NULL;</P>2 Z9 h$ R8 e" H* ^  b6 p
  12. <P>//Get the direction
    . Z% e0 F/ R$ S  q. P
  13. PropertyList* vectorPropertyList = vector0->GetProperties();) T) {, x5 Q- a% n, j. G" _; S
  14. Vector3d direction = vectorPropertyList->GetVector("Vector");8 p2 E0 J1 Z# C2 r: k- k
  15. delete vectorPropertyList;
    ( X) N: Z& b1 g2 l# N( _
  16. vectorPropertyList = NULL;</P>8 O% k, ^& ^1 S, s) s5 f
  17. <P>Direction* direction1 = NULL;) p1 l, M4 J: L
  18. direction1 = workPart->Directions()->CreateDirection(originPoint, direction, SmartObject::UpdateOptionWithinModeling);</P>6 ]  r6 Y- n& q* ]& l3 ]# D
  19. <P>//Set diameter and height# Y. ]/ t0 j6 `* l; t. }/ B3 E
  20. std::stringstream diameterValue;$ `8 m( H! r/ I' b; W
  21. diameterValue << diameter->GetValue();8 x: I7 F$ X: g/ A( g
  22. std::stringstream heightValue;" F& T% e, \3 W% N0 I8 f* {9 o
  23. heightValue << height->GetValue();</P>5 X/ n' M+ v  s6 l! ?/ G
  24. <P>cylinderBuilder1->Diameter()->SetRightHandSide(diameterValue.str());% _$ ?6 M4 Y& P) I7 u/ F: J
  25. cylinderBuilder1->Height()->SetRightHandSide(heightValue.str());</P>1 b) `) E  D4 ?! f2 E
  26. <P>//Set the axis* R! s" T' q9 c: Q& s3 o
  27. Axis* axis1 = NULL;
    0 U5 N$ v7 P+ x) |1 F/ j
  28. axis1 = cylinderBuilder1->Axis();) y9 R- \$ }- T( Z5 I
  29. axis1->Point()->SeTCoordinates(originPoint);
      u0 b0 f  x/ [6 o
  30. axis1->SetDirection(direction1);</P>
    - s7 `! {0 u3 i5 C' P* ]
  31. <P>//Commit
    - m2 T; s0 I' c) O' N8 _7 s; k8 a
  32. cylinderBuilder1->Commit();
    ) E$ E* S/ n9 S  `* |
  33. cylinderBuilder1->Destroy();# G7 o, V5 y2 {4 A
  34. cylinderBuilder1 = NULL;
    1 ~* B5 K* W: s& w% G
  35. }. G4 D' H- o/ u5 D3 Q+ q2 K4 l
  36. </P>
复制代码
9 G: r$ r# }) U: q- b
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了