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

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

[复制链接]

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

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

admin 楼主

2013-11-4 12:06:33

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

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

x
NX二次开发源码分享:NXOpen C++创建圆柱体特征
& `0 e$ k( Q7 m" Z

  1.   ]+ H& x' x2 V6 Q' W
  2. <P> </P>
复制代码

  1. , ]. _5 [( T% ^% q7 x' Q% I
  2. <P>void CreateCylinder_UsingUDB::CreateCylinder()
    ; Q6 e: \; m: d
  3. {
    ; n3 X& x3 B$ m  f6 |, _  y" p
  4. Part* workPart(theSession->Parts()->Work());</P>! j- N. H$ [: C' f6 p3 v  b
  5. <P>Features::CylinderBuilder* cylinderBuilder1 = NULL;
    , J6 t  i8 O# W$ Q1 I
  6. cylinderBuilder1 = workPart->Features()->CreateCylinderBuilder(NULL);</P>
    0 ^- X& K! T% b! @  J9 w  |
  7. <P>//Get the point3 E' `3 z, w; P$ u9 Q
  8. PropertyList* pointPropertyList = point0->GetProperties();$ ]& k2 H) @$ ?$ K" d! j5 V
  9. Point3d originPoint = pointPropertyList->GetPoint("Point");
    4 j5 J2 l  u4 ~- U( _& d
  10. delete pointPropertyList;, @+ _2 f- x% f+ M, \
  11. pointPropertyList = NULL;</P>
      x" I  C& Y/ e4 g6 A
  12. <P>//Get the direction
    7 e/ e! @$ q9 X) E  j: U
  13. PropertyList* vectorPropertyList = vector0->GetProperties();
    5 K4 {. G) B4 l/ ^3 E* T
  14. Vector3d direction = vectorPropertyList->GetVector("Vector");
    ; u) n1 j' ~/ ]& x
  15. delete vectorPropertyList;
    5 X' Z. P, d+ ]1 \" b1 Y- c6 |
  16. vectorPropertyList = NULL;</P>. e  q) a( [% M
  17. <P>Direction* direction1 = NULL;9 h( J* A* x; d
  18. direction1 = workPart->Directions()->CreateDirection(originPoint, direction, SmartObject::UpdateOptionWithinModeling);</P>
    % q0 \2 Q: [- m0 C3 U
  19. <P>//Set diameter and height( \6 l5 k" U6 ^7 K+ t! t! O
  20. std::stringstream diameterValue;
    3 b) b$ X' k+ x' t
  21. diameterValue << diameter->GetValue();
    1 x! q! x6 H: r' G* i0 [  z" ?& F
  22. std::stringstream heightValue;
    5 w+ Z! R  K4 @0 }1 x, w
  23. heightValue << height->GetValue();</P>
    " W4 ^' R" L9 C, j
  24. <P>cylinderBuilder1->Diameter()->SetRightHandSide(diameterValue.str());9 n8 q* y  _9 e5 s% x$ n; s! E
  25. cylinderBuilder1->Height()->SetRightHandSide(heightValue.str());</P>6 `% s' Q; K" o5 D4 ^& T
  26. <P>//Set the axis
    # v' n9 y- j/ M& ]+ U7 ~0 F
  27. Axis* axis1 = NULL;& p/ W6 a: N1 t% _1 Z/ B
  28. axis1 = cylinderBuilder1->Axis();
    / `- a) K  s) y
  29. axis1->Point()->SeTCoordinates(originPoint);
    . g  ~$ E# O! Y, Z0 G2 ?  x% R& a
  30. axis1->SetDirection(direction1);</P>* U! O  d, i) o6 }! [3 j9 W2 W
  31. <P>//Commit) O* i0 c. n4 x# W7 h3 @# D
  32. cylinderBuilder1->Commit();
    6 {, [% q% _' j6 r$ {
  33. cylinderBuilder1->Destroy();
    0 x9 o' F6 K3 |% `
  34. cylinderBuilder1 = NULL;
    % h- a% k$ r  V4 U6 ^' i8 N
  35. }
    5 Z3 ?% p; X- ]8 c
  36. </P>
复制代码
( {( _+ G& t4 m9 J
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了