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

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

[复制链接]

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

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

admin 楼主

2013-11-4 12:06:33

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

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

x
NX二次开发源码分享:NXOpen C++创建圆柱体特征
' A% z1 K8 V3 b3 I
  1. " ~5 \! q5 a9 v( p: d! A. e8 R5 R
  2. <P> </P>
复制代码
  1.   q8 s5 C$ p( A! k; c4 e6 U
  2. <P>void CreateCylinder_UsingUDB::CreateCylinder()$ z$ k" [! Y5 U* R6 |) Q% p. p
  3. {' Z0 U5 N# l: J. t
  4. Part* workPart(theSession->Parts()->Work());</P>
    ! V5 b' e, ~# Z9 s
  5. <P>Features::CylinderBuilder* cylinderBuilder1 = NULL;
    " U, a4 z& s  }  s$ m$ ~
  6. cylinderBuilder1 = workPart->Features()->CreateCylinderBuilder(NULL);</P>) S) b0 O* W- s1 a% t$ x6 b3 U
  7. <P>//Get the point
    , F- B. ]7 g  ^
  8. PropertyList* pointPropertyList = point0->GetProperties();: t1 ]1 p/ X5 C' |
  9. Point3d originPoint = pointPropertyList->GetPoint("Point");, x7 h# O7 O; o" ]( ~6 E
  10. delete pointPropertyList;0 Q0 U  e0 v$ P
  11. pointPropertyList = NULL;</P>
    % [# A; o! ]0 e7 o4 Y
  12. <P>//Get the direction
    0 K+ }+ ]: O0 V/ ?9 E; H& H
  13. PropertyList* vectorPropertyList = vector0->GetProperties();
    1 e$ ?5 B* D1 m' ~
  14. Vector3d direction = vectorPropertyList->GetVector("Vector");
    + T. R3 u* J0 o2 B: I. S
  15. delete vectorPropertyList;' s& U4 E: C" b% h/ W9 |
  16. vectorPropertyList = NULL;</P>
    2 _+ A* O$ A8 i8 n! g# p
  17. <P>Direction* direction1 = NULL;
    : Q9 m: q" @9 O  ?) v% K! ]
  18. direction1 = workPart->Directions()->CreateDirection(originPoint, direction, SmartObject::UpdateOptionWithinModeling);</P>
    6 a6 H) B  H& A
  19. <P>//Set diameter and height$ l7 K1 e% Y+ R  m, |, s7 b
  20. std::stringstream diameterValue;! w; t' S) n/ s  y2 m3 `1 a( W) y6 p
  21. diameterValue << diameter->GetValue();* b1 [+ c+ k5 w: `; @
  22. std::stringstream heightValue;3 H1 W& R% C3 q7 s
  23. heightValue << height->GetValue();</P>
    % L1 _* I* \% \2 P
  24. <P>cylinderBuilder1->Diameter()->SetRightHandSide(diameterValue.str());) z/ n  ]# y- z+ p" L& B) G8 _5 m
  25. cylinderBuilder1->Height()->SetRightHandSide(heightValue.str());</P>
    ( N& x& M+ @; [7 R8 B
  26. <P>//Set the axis) ?3 A0 _( S: m. P
  27. Axis* axis1 = NULL;
    " |8 m" k5 N* j( w# Q' n
  28. axis1 = cylinderBuilder1->Axis();
    ! g. X9 _$ K  \: M4 R
  29. axis1->Point()->SeTCoordinates(originPoint);
    . d3 o: c  x/ I! X7 {6 n9 l
  30. axis1->SetDirection(direction1);</P>: w9 k9 X* c5 ?
  31. <P>//Commit
      I. G7 k- b+ c7 \3 h
  32. cylinderBuilder1->Commit();
    . t" D- z3 E, p7 H
  33. cylinderBuilder1->Destroy();* X" ?. i. w  x! D
  34. cylinderBuilder1 = NULL;
    ( Q$ R: x0 Z/ K3 r) q. d) t
  35. }
    - Y7 N% V* O1 `$ K, d* F6 U+ \$ y  [
  36. </P>
复制代码
$ L5 s, {' j( ~( n- P! T
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了