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

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

[复制链接]

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

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

admin 楼主

2013-11-4 12:06:33

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

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

x
NX二次开发源码分享:NXOpen C++创建圆柱体特征  R4 P7 o) }9 q0 q

  1. $ u5 N7 o& `& x
  2. <P> </P>
复制代码
  1. : ]0 e) q/ Y- E; N; V/ j7 Y  o! t
  2. <P>void CreateCylinder_UsingUDB::CreateCylinder()5 J6 K/ H8 K1 `) p5 ~
  3. {
    - g# \- \- X& ^/ c/ H" R5 S
  4. Part* workPart(theSession->Parts()->Work());</P>/ L$ k: X' |- H; r. }  y; G( K
  5. <P>Features::CylinderBuilder* cylinderBuilder1 = NULL;
    7 o! b. P5 V3 ]) u4 R  C1 x
  6. cylinderBuilder1 = workPart->Features()->CreateCylinderBuilder(NULL);</P>5 x3 F" L4 N3 j1 ^
  7. <P>//Get the point
    ; n6 l  ^3 J9 K
  8. PropertyList* pointPropertyList = point0->GetProperties();
    0 }) X2 K. g, l2 G. a6 M
  9. Point3d originPoint = pointPropertyList->GetPoint("Point");
    6 M4 D5 X( A1 C9 P
  10. delete pointPropertyList;  J2 w% S/ S: ]0 V) u8 \: E8 {
  11. pointPropertyList = NULL;</P>$ ?$ {  Q3 W3 M7 Y& x# z
  12. <P>//Get the direction7 D6 b) c6 G8 S/ h
  13. PropertyList* vectorPropertyList = vector0->GetProperties();
    # Q$ t& K$ A1 p$ S3 {* o. ~
  14. Vector3d direction = vectorPropertyList->GetVector("Vector");5 R7 {# V1 c* R8 a$ P0 N! }
  15. delete vectorPropertyList;4 L/ e' }/ E& p7 u, Z& l5 T' W
  16. vectorPropertyList = NULL;</P>
    ; G; H" P9 L( ^3 {2 \2 H" ~' i8 [& p
  17. <P>Direction* direction1 = NULL;
    7 p* U3 g+ T8 J8 S/ ~
  18. direction1 = workPart->Directions()->CreateDirection(originPoint, direction, SmartObject::UpdateOptionWithinModeling);</P>9 G  b& f& [: D3 d6 r
  19. <P>//Set diameter and height, C9 O& B: _! k% U
  20. std::stringstream diameterValue;
    0 P5 e7 J. ^+ S0 I+ ^, k) ]
  21. diameterValue << diameter->GetValue();
    6 K! S; U+ K, j8 Z1 n8 u& G, ]
  22. std::stringstream heightValue;0 m! Z* a4 C& n4 V/ X0 M
  23. heightValue << height->GetValue();</P># S: g  ^  h3 Z1 _3 |; A
  24. <P>cylinderBuilder1->Diameter()->SetRightHandSide(diameterValue.str());
    " J3 V2 e& w4 u$ l; B0 N0 D+ Y3 b
  25. cylinderBuilder1->Height()->SetRightHandSide(heightValue.str());</P>% e+ {$ J9 u" [
  26. <P>//Set the axis
    % K+ j; R4 B4 S$ c
  27. Axis* axis1 = NULL;
    , S  \' K% M8 y
  28. axis1 = cylinderBuilder1->Axis();+ L) l  }% {+ Q$ A, h; y4 z( d, e0 |' d- i
  29. axis1->Point()->SeTCoordinates(originPoint);
    $ R& v  v/ _4 N; X* G0 L6 l
  30. axis1->SetDirection(direction1);</P>( L; j" \6 Z8 E# O- ~# D: R9 O0 H
  31. <P>//Commit5 J  g3 ~; Y  s4 ]
  32. cylinderBuilder1->Commit();
    - X( q! L, S* U2 Q2 ?
  33. cylinderBuilder1->Destroy();
    ( ?! _& k* X" x% Y
  34. cylinderBuilder1 = NULL;
    ' `# f4 j3 E6 L% S4 {' G& ?
  35. }7 l1 D4 J2 w. `, t: n. j, v
  36. </P>
复制代码
) t# O" n. k5 [: ^" U1 Y) r. 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二次开发专题模块培训报名开始啦

    我知道了