PLM之家PLMHome-工业软件践行者

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

[复制链接]

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

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

admin 楼主

2013-11-4 12:06:33

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

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

x
NX二次开发源码分享:NXOpen C++创建圆柱体特征
6 A( U) |8 W5 K8 F
  1. ) @1 p1 G9 i" `, C
  2. <P> </P>
复制代码

  1. ' U7 d! H+ u6 v8 |; b; y
  2. <P>void CreateCylinder_UsingUDB::CreateCylinder()
    / B( v% _, H' f0 c0 f) p" v
  3. {7 U$ |4 D, L9 ~! {/ ~! e8 y
  4. Part* workPart(theSession->Parts()->Work());</P>, w3 C6 d. R% }  H: \+ f
  5. <P>Features::CylinderBuilder* cylinderBuilder1 = NULL;
    1 q9 q- ]+ G* c" C$ c# N* Z
  6. cylinderBuilder1 = workPart->Features()->CreateCylinderBuilder(NULL);</P>/ r. `7 ~% p- t. F
  7. <P>//Get the point; t$ o! d6 P+ ~$ S5 I7 ?. G8 x" h
  8. PropertyList* pointPropertyList = point0->GetProperties();+ b) F5 Y' x) c3 y, s; G- C' T# B
  9. Point3d originPoint = pointPropertyList->GetPoint("Point");5 D: Q. }. Q2 }$ L1 S, v* o% M
  10. delete pointPropertyList;: ?/ w* S6 B, ~( \5 j  X* U5 f5 _
  11. pointPropertyList = NULL;</P>3 c+ i0 I$ K1 r( S3 g& f$ `  s
  12. <P>//Get the direction
    9 w! q+ S0 b; g3 K
  13. PropertyList* vectorPropertyList = vector0->GetProperties();
    ' M3 k' \# V# t" B( b9 j" Q: \
  14. Vector3d direction = vectorPropertyList->GetVector("Vector");2 i; s* G8 o3 M1 q* Q
  15. delete vectorPropertyList;; w6 f# o6 {+ b/ ]: p0 O" |  I/ H, F
  16. vectorPropertyList = NULL;</P>$ N* h' V$ @: M0 A6 C
  17. <P>Direction* direction1 = NULL;7 R3 D( N2 d4 z8 o, _+ H
  18. direction1 = workPart->Directions()->CreateDirection(originPoint, direction, SmartObject::UpdateOptionWithinModeling);</P>
    1 [( u& M$ k9 C) Q  G# c
  19. <P>//Set diameter and height' w8 X0 g1 Q# R4 j3 I0 \: m# m# q) }0 ^
  20. std::stringstream diameterValue;
      Y- d; r& k; V# s; T" b# U: j
  21. diameterValue << diameter->GetValue();  N' u* }. L9 p; Y+ U
  22. std::stringstream heightValue;
    - F& N" q  L0 |
  23. heightValue << height->GetValue();</P>7 T; p! E) E3 b
  24. <P>cylinderBuilder1->Diameter()->SetRightHandSide(diameterValue.str());- h/ o4 d& a/ G5 w3 I
  25. cylinderBuilder1->Height()->SetRightHandSide(heightValue.str());</P>% P3 R8 a: M5 V$ Z4 }! R. W
  26. <P>//Set the axis0 o5 g8 T) w9 O; b6 |5 M  a
  27. Axis* axis1 = NULL;* C% Q. w2 T+ t& W1 \7 a/ T; I
  28. axis1 = cylinderBuilder1->Axis();
    ) r4 W5 L9 Z' H
  29. axis1->Point()->SeTCoordinates(originPoint);% M* r& O" \+ ]: f2 ~0 \4 O! I
  30. axis1->SetDirection(direction1);</P>
    ! w" z9 f5 ^* ?$ ]" F5 k2 f
  31. <P>//Commit
    , I( r& }+ _/ |, Q9 O" g/ y
  32. cylinderBuilder1->Commit();) I: u2 ?. {9 _7 u
  33. cylinderBuilder1->Destroy();
    + q  z0 m9 y# f! n! {# S" x8 W
  34. cylinderBuilder1 = NULL;; V1 t1 D! a5 o5 J. f9 r9 L
  35. }+ T9 m; @1 m2 B( u4 I9 o% I' Y
  36. </P>
复制代码

7 N# ?3 t; U9 y/ n; 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二次开发专题模块培训报名开始啦

    我知道了