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

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

[复制链接]

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

2470

主题

1275

回帖

8万

积分

管理员

PLM之家站长

积分
82162
QQ
发表于 2013-11-4 12:06:33 | 显示全部楼层 |阅读模式

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

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

x
NX二次开发源码分享:NXOpen C++创建圆柱体特征
9 t/ G) t" Z; @0 A; h! x% O& P$ S& X
  1. 3 I! }+ q; U9 _, X' T
  2. <P> </P>
复制代码

  1. + P- k' s/ N. M+ [% A/ y1 F
  2. <P>void CreateCylinder_UsingUDB::CreateCylinder(): T2 `& p" V$ t2 p+ R
  3. {3 v  P5 a; X( t% }
  4. Part* workPart(theSession->Parts()->Work());</P>% w# l: b( w. F' z
  5. <P>Features::CylinderBuilder* cylinderBuilder1 = NULL;4 q7 Z" M/ N% I
  6. cylinderBuilder1 = workPart->Features()->CreateCylinderBuilder(NULL);</P>
    / h# A: o5 l1 Y4 z) `% P2 N! v, r
  7. <P>//Get the point! m* x% s7 _7 o9 d( C
  8. PropertyList* pointPropertyList = point0->GetProperties();
    % e; \( ^. D  K1 H8 }  @' i
  9. Point3d originPoint = pointPropertyList->GetPoint("Point");
    5 ]# d8 ~! f- p5 a& N7 T
  10. delete pointPropertyList;
    - D" f# a. N6 ?5 m8 R7 T2 d
  11. pointPropertyList = NULL;</P>7 b# V3 _  H6 d! K( T7 ?
  12. <P>//Get the direction
    2 B$ p# x9 ?: Y) ~! r
  13. PropertyList* vectorPropertyList = vector0->GetProperties();8 R) f5 u/ R7 O/ ]
  14. Vector3d direction = vectorPropertyList->GetVector("Vector");
    + ~* K1 J( g0 V% @7 z* i
  15. delete vectorPropertyList;
    3 G; |$ T: i" B1 W. N5 F
  16. vectorPropertyList = NULL;</P>
    * z6 g4 W7 |$ \
  17. <P>Direction* direction1 = NULL;5 p7 D! L6 C" R9 K. I" Y, M
  18. direction1 = workPart->Directions()->CreateDirection(originPoint, direction, SmartObject::UpdateOptionWithinModeling);</P>
    ) u. }; \, ]% R7 Z
  19. <P>//Set diameter and height
    ( [7 B5 {# f% r
  20. std::stringstream diameterValue;
    " j2 ~; g: {, m: S# F' m
  21. diameterValue << diameter->GetValue();% D9 c) |+ G, h( g) Q  I: S  {
  22. std::stringstream heightValue;6 M* H4 [: p& U# F# A& }2 d5 z& W
  23. heightValue << height->GetValue();</P>5 ~/ k5 X+ N, J- v0 `
  24. <P>cylinderBuilder1->Diameter()->SetRightHandSide(diameterValue.str());
    3 P# Y3 k6 _$ K! H* u
  25. cylinderBuilder1->Height()->SetRightHandSide(heightValue.str());</P>) J& s1 S1 b) ?+ @" s9 Z* F
  26. <P>//Set the axis
    : C8 u4 K, Z& f8 d
  27. Axis* axis1 = NULL;2 J0 \: V5 a+ k0 n( j' W1 A. p/ M1 L
  28. axis1 = cylinderBuilder1->Axis();$ N& @/ S: f& g6 k- r4 d( b
  29. axis1->Point()->SeTCoordinates(originPoint);( d) X% d1 Y: q: F* a" E. ]
  30. axis1->SetDirection(direction1);</P>: L, N' }" e+ }' o" V0 t/ u
  31. <P>//Commit; ~% U0 {, h' V7 w. ~& p5 B3 Q+ m
  32. cylinderBuilder1->Commit();
    - M; y  ~7 N# u' k3 r
  33. cylinderBuilder1->Destroy();! d# p/ o) }# Q& E
  34. cylinderBuilder1 = NULL;
    , H+ z8 g( B# H) X6 q! Z6 i. b
  35. }
    , M" j* H: {- [# X3 c) I
  36. </P>
复制代码
6 e- H) R+ Q" S6 l3 S. |8 U
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了