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

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

[复制链接]

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

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

admin 楼主

2013-11-4 12:06:33

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

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

x
NX二次开发源码分享:NXOpen C++创建圆柱体特征
3 k& A8 K% T( t( E5 G
  1. 8 k" |4 h2 T4 }1 C' k
  2. <P> </P>
复制代码

  1. 2 F- |! I& B- k  s
  2. <P>void CreateCylinder_UsingUDB::CreateCylinder()! k7 e- c$ p9 Y5 R! {4 x1 ~; F
  3. {% U4 z8 a3 C8 G) T+ ~* k
  4. Part* workPart(theSession->Parts()->Work());</P>- }# b' {$ \. e1 j* C  @
  5. <P>Features::CylinderBuilder* cylinderBuilder1 = NULL;% T' W6 ?/ q+ H% Y
  6. cylinderBuilder1 = workPart->Features()->CreateCylinderBuilder(NULL);</P>
    . \3 M1 i! `# E; I7 S6 d& Q7 z
  7. <P>//Get the point7 }  m, q6 a+ x; Z% ?
  8. PropertyList* pointPropertyList = point0->GetProperties();
    8 i/ Q# F2 b3 G* \/ I# t0 Q
  9. Point3d originPoint = pointPropertyList->GetPoint("Point");, r0 @/ {# Y+ J  \% `, C) B
  10. delete pointPropertyList;3 B3 r3 C; u0 W, F( T1 i6 O* Q. b
  11. pointPropertyList = NULL;</P>* [2 w6 N' N; H9 ]$ r/ P
  12. <P>//Get the direction! f3 {" M# z- }3 ~/ F
  13. PropertyList* vectorPropertyList = vector0->GetProperties();
    " y5 p. U: t; M0 X& M+ b
  14. Vector3d direction = vectorPropertyList->GetVector("Vector");
    5 T9 ~- s" t6 B! Y
  15. delete vectorPropertyList;
    ! }# U& f! P2 k1 V8 k
  16. vectorPropertyList = NULL;</P>
    ' o0 T& ]6 l# ?5 H* b1 e  F
  17. <P>Direction* direction1 = NULL;2 J$ A* t. P7 y% W; U
  18. direction1 = workPart->Directions()->CreateDirection(originPoint, direction, SmartObject::UpdateOptionWithinModeling);</P>3 C( }( I9 U; U8 j- T3 l' R) X+ [
  19. <P>//Set diameter and height
    ; P- ^$ u, n; A1 ]- i- c
  20. std::stringstream diameterValue;
    $ c1 @+ X7 O9 P/ s/ |, d
  21. diameterValue << diameter->GetValue();, h! J9 c1 Q+ L& r
  22. std::stringstream heightValue;
    ' k/ E  w% ~3 V
  23. heightValue << height->GetValue();</P>
    7 E' h4 b( F$ k- G+ G0 I4 G
  24. <P>cylinderBuilder1->Diameter()->SetRightHandSide(diameterValue.str());- S& f, ^$ V: f! e
  25. cylinderBuilder1->Height()->SetRightHandSide(heightValue.str());</P>
    ; H2 u0 o" e# u# p
  26. <P>//Set the axis
    ( u# M7 ~. X5 M5 q: X
  27. Axis* axis1 = NULL;
    0 P5 P, b! f3 R8 E
  28. axis1 = cylinderBuilder1->Axis();- J( W4 K/ B3 t2 {3 C$ x
  29. axis1->Point()->SeTCoordinates(originPoint);, k8 A1 V$ i* h; L
  30. axis1->SetDirection(direction1);</P>) l! Z' y( q: I% P0 d2 b
  31. <P>//Commit
    2 Y, R# q/ C' R: u( N
  32. cylinderBuilder1->Commit();& d. @9 F; K4 y( P
  33. cylinderBuilder1->Destroy();
    * X8 Z. T% {9 T/ k0 s8 C
  34. cylinderBuilder1 = NULL;8 f  G; ~( `1 Y6 @3 n
  35. }$ N: L6 u; W' j3 H5 W
  36. </P>
复制代码

% o( Y6 R1 G1 L5 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二次开发专题模块培训报名开始啦

    我知道了