PLM之家精品课程培训,联系电话:18301858168 QQ: 939801026

  • NX二次开培训

    NX二次开培训

    适合初级入门或想深入了解二次开发的工程师,本培训结合ufun,NXOpen C++,大量的实例及官方内部的开发技术对于老鸟也值得借鉴!.

    NX CAM二次开发培训报名 NX二次开发基础培训报名
  • PLM之家Catia CAA二次开发培训

    Catia二次开发培训

    Catia二次开发的市场大,这方面开发人才少,难度大。所以只要你掌握了开发,那么潜力巨大,随着时间的积累,你必将有所用武之地!

  • PLM之Teamcenter最佳学习方案

    Teamcenter培训

    用户应用基础培训,管理员基础培训,管理员高级培训,二次开发培训应有尽有,只要你感兴趣肯学习,专业多年经验大师级打造!

  • PLM之Tecnomatix制造领域培训

    Tecnomatix培训

    想了解制造领域数字化吗?想了解工厂,生产线设计吗?数字化双胞胎,工业4.0吗?我们的课程虚位以待!

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

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

[复制链接]

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

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

admin 楼主

2013-11-4 12:06:33

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

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

x
NX二次开发源码分享:NXOpen C++创建圆柱体特征# n$ @1 B. W& y4 h8 t* c
  1. # b2 n* J+ v. ]7 ~5 A  |( v7 M
  2. <P> </P>
复制代码

  1. / d- h4 t* w$ \
  2. <P>void CreateCylinder_UsingUDB::CreateCylinder()
    , X1 Q, @3 h  G; W( n+ d
  3. {
    1 c, D7 b( z" @; m9 l- S
  4. Part* workPart(theSession->Parts()->Work());</P>' P5 z7 Y2 p% E1 n6 M7 b
  5. <P>Features::CylinderBuilder* cylinderBuilder1 = NULL;2 y8 J, q& }/ k* I/ T5 `1 V( [: ^* K
  6. cylinderBuilder1 = workPart->Features()->CreateCylinderBuilder(NULL);</P>/ ^. X( B$ l- B$ D" Y
  7. <P>//Get the point
    " q: a4 i  X3 W: L' g9 H# N
  8. PropertyList* pointPropertyList = point0->GetProperties();5 c0 i8 Q$ s" k3 x  @& O2 Y
  9. Point3d originPoint = pointPropertyList->GetPoint("Point");
    6 Y1 T7 r# r" _: E! B% \; a
  10. delete pointPropertyList;
    * `2 B5 Y% c  _( T; C9 \
  11. pointPropertyList = NULL;</P>+ Q+ _; E+ c7 l# ?/ I+ K
  12. <P>//Get the direction4 B( P6 y( M: b$ J
  13. PropertyList* vectorPropertyList = vector0->GetProperties();
    4 Z! C2 \# C6 x
  14. Vector3d direction = vectorPropertyList->GetVector("Vector");$ h$ \0 K6 V, _2 D1 X' t! m3 r
  15. delete vectorPropertyList;+ J8 a! z! P( l1 l2 E
  16. vectorPropertyList = NULL;</P>
    7 |; u) l5 r  f& p3 G5 g
  17. <P>Direction* direction1 = NULL;7 H, F+ ]0 i0 r, m2 R  P
  18. direction1 = workPart->Directions()->CreateDirection(originPoint, direction, SmartObject::UpdateOptionWithinModeling);</P>4 M9 p0 A2 M5 T/ ^" n# U
  19. <P>//Set diameter and height
    ! M2 w, M+ b2 H8 L
  20. std::stringstream diameterValue;4 R: e. _+ x* {1 y$ f0 \5 k
  21. diameterValue << diameter->GetValue();& ^6 y6 ~5 I. L
  22. std::stringstream heightValue;+ U( L: l$ ~+ \# d$ t
  23. heightValue << height->GetValue();</P>
    ) D* w2 `/ |1 u" g
  24. <P>cylinderBuilder1->Diameter()->SetRightHandSide(diameterValue.str());# n* M; ~4 B  O- X* F1 _) h
  25. cylinderBuilder1->Height()->SetRightHandSide(heightValue.str());</P>
    5 U! a* @) h8 Q- T5 |- ~
  26. <P>//Set the axis
    ! J8 S7 y" N! W( @* M6 b- z
  27. Axis* axis1 = NULL;
    " L" F, W; _/ u' r' e: Y% L
  28. axis1 = cylinderBuilder1->Axis();  j  n$ V+ _/ Y* ~
  29. axis1->Point()->SeTCoordinates(originPoint);$ K) |7 s  U0 }  Y% X" ^4 B* O
  30. axis1->SetDirection(direction1);</P>
    , X+ I/ Y5 B* Y9 D' `$ S2 N% k
  31. <P>//Commit
    ! z7 e$ t/ i4 S" J' B- @, m
  32. cylinderBuilder1->Commit();) L+ j: [9 [0 v7 e" i
  33. cylinderBuilder1->Destroy();% g2 D( a7 t. m4 B
  34. cylinderBuilder1 = NULL;7 f/ [+ C2 L) t) q
  35. }
    + X1 `% M8 @. r4 o" v2 w  T% ~
  36. </P>
复制代码

/ z- S# f6 m" T; Z
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.diantuankj.com/ doTeam.tech
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 注册

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

    本网站(plmhome.com)为PLM之家工业软件学习官网站

    展示的视频材料全部免费,需要高清和特殊技术支持请联系 QQ: 939801026

    PLM之家NX CAM二次开发专题模块培训报名开始啦

    我知道了