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

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

[复制链接]

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

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

admin 楼主

2013-11-4 12:06:33

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

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

x
NX二次开发源码分享:NXOpen C++创建圆柱体特征
. ^0 Z, m8 `0 F! P

  1. $ w* b. L$ |% }% t+ H  Q7 |0 m) Q
  2. <P> </P>
复制代码

  1. % d3 j7 c- J9 @( _2 A
  2. <P>void CreateCylinder_UsingUDB::CreateCylinder()
    0 y$ w+ z  F8 ]2 Y
  3. {$ O* P6 }/ u; k+ a
  4. Part* workPart(theSession->Parts()->Work());</P>5 J  @' e4 K6 E3 n* @+ I) |! G1 o
  5. <P>Features::CylinderBuilder* cylinderBuilder1 = NULL;! i! @, i: o  g) ~4 @
  6. cylinderBuilder1 = workPart->Features()->CreateCylinderBuilder(NULL);</P>& f9 u' x- N2 G' Z+ R3 r( y
  7. <P>//Get the point; K6 l/ ?9 [- q
  8. PropertyList* pointPropertyList = point0->GetProperties();* [1 y  h! m% ^+ ?& T
  9. Point3d originPoint = pointPropertyList->GetPoint("Point");
    & }9 A# y, c, O0 s# T. Z
  10. delete pointPropertyList;  N7 d- M/ @- D  {0 U' A1 V2 a" J
  11. pointPropertyList = NULL;</P>
    & w/ a: V- @" u4 Q
  12. <P>//Get the direction0 U& g3 V9 [5 X' Q" G$ v! [
  13. PropertyList* vectorPropertyList = vector0->GetProperties();; L5 ], {1 y& U0 b: V
  14. Vector3d direction = vectorPropertyList->GetVector("Vector");2 y, m( p/ Z5 M9 a4 \& C( I. y
  15. delete vectorPropertyList;, R$ ~: S5 B& u. U
  16. vectorPropertyList = NULL;</P>
    - `6 i$ k% Z0 F# C+ L7 [3 J
  17. <P>Direction* direction1 = NULL;3 F! _- [8 g* X  E# }# J
  18. direction1 = workPart->Directions()->CreateDirection(originPoint, direction, SmartObject::UpdateOptionWithinModeling);</P>1 y7 G& }% M& {, S$ I
  19. <P>//Set diameter and height; Z; n4 R5 v3 Q- `/ t6 j
  20. std::stringstream diameterValue;
    ) u8 I8 a; ?3 F+ I
  21. diameterValue << diameter->GetValue();; A3 {: W1 `1 ~+ T5 M/ m
  22. std::stringstream heightValue;
    ( m4 e! G5 P: q) q$ g& Q/ v
  23. heightValue << height->GetValue();</P>! P+ Z. A: A) B9 D
  24. <P>cylinderBuilder1->Diameter()->SetRightHandSide(diameterValue.str());! g$ B% `& q2 q% y' H
  25. cylinderBuilder1->Height()->SetRightHandSide(heightValue.str());</P>
    3 D. A% L( _6 [9 u+ c4 g
  26. <P>//Set the axis2 z8 k2 R1 J1 S, T( _! R) z5 F: R
  27. Axis* axis1 = NULL;
    , n( n/ e* V3 Q. q% d
  28. axis1 = cylinderBuilder1->Axis();
    & t* N( _3 g  F
  29. axis1->Point()->SeTCoordinates(originPoint);
    & t+ F3 o7 D" F: ]9 f% C! b
  30. axis1->SetDirection(direction1);</P>
    & z9 U. S" m: p8 q- K4 e) S
  31. <P>//Commit
    + I  Z$ r. D$ o3 R, V  m0 ]
  32. cylinderBuilder1->Commit();
    6 V) m1 _! {: o/ [' c: }; Y- r
  33. cylinderBuilder1->Destroy();7 U" r8 [- i$ L5 ]5 V6 B8 w
  34. cylinderBuilder1 = NULL;
    6 V- J/ t8 {" X% [4 b
  35. }, F  g) N% V: f1 f$ o* S+ m
  36. </P>
复制代码
( c2 J6 W' ?$ b) j6 ~
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了