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

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

[复制链接]

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

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

admin 楼主

2013-11-4 12:06:33

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

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

x
NX二次开发源码分享:NXOpen C++创建圆柱体特征
/ |/ f3 X. b  Z- r  B

  1. 3 f- ^) g/ D1 m1 X
  2. <P> </P>
复制代码

  1. 1 O, w; T: p! }5 c* E0 l7 H' ]
  2. <P>void CreateCylinder_UsingUDB::CreateCylinder()
    % X! S: j/ d; m0 Z3 r, q
  3. {
    ! t5 {7 p* C7 G8 D# m
  4. Part* workPart(theSession->Parts()->Work());</P>
    , L0 }6 ?; }# K. l- u
  5. <P>Features::CylinderBuilder* cylinderBuilder1 = NULL;, `; {% N8 I: R* `
  6. cylinderBuilder1 = workPart->Features()->CreateCylinderBuilder(NULL);</P>
    , P6 ^8 ?# @" F6 t. q3 a
  7. <P>//Get the point
    0 h5 G5 j: U8 P' L
  8. PropertyList* pointPropertyList = point0->GetProperties();) v, A4 g. K$ w+ s
  9. Point3d originPoint = pointPropertyList->GetPoint("Point");
    ! K0 X: ?$ ]7 q. F% z
  10. delete pointPropertyList;
    0 u% r0 ]# [  e  ?& q7 _( U
  11. pointPropertyList = NULL;</P>
    3 }7 ?# ?% q! \3 r3 g, S  s+ \
  12. <P>//Get the direction+ q3 C: C0 O2 g' s/ p' k
  13. PropertyList* vectorPropertyList = vector0->GetProperties();0 f/ U( g) q" X
  14. Vector3d direction = vectorPropertyList->GetVector("Vector");
    $ G+ \0 r5 h, Q! G$ M) k
  15. delete vectorPropertyList;
      M- X, V5 o3 A& {% g8 n
  16. vectorPropertyList = NULL;</P>
    / I6 w, b- u- U& s4 ^
  17. <P>Direction* direction1 = NULL;
    . c( n- h1 E2 p, Y* Q- t
  18. direction1 = workPart->Directions()->CreateDirection(originPoint, direction, SmartObject::UpdateOptionWithinModeling);</P>
    2 O3 n8 F- x. D; Z4 y! T* @0 _( t
  19. <P>//Set diameter and height* R: F" O; ?* O* L; U( M+ S
  20. std::stringstream diameterValue;: z0 C8 Y/ S& X/ o
  21. diameterValue << diameter->GetValue();3 e) }9 W2 i8 l" }- u3 M
  22. std::stringstream heightValue;
    ; O; |& |5 z2 F' I
  23. heightValue << height->GetValue();</P>2 i4 `* k6 U9 l$ m
  24. <P>cylinderBuilder1->Diameter()->SetRightHandSide(diameterValue.str());# [* _8 {+ }: d5 t/ g' ?
  25. cylinderBuilder1->Height()->SetRightHandSide(heightValue.str());</P>
    ; v3 j- A( r, j! G4 M
  26. <P>//Set the axis0 c. g5 m" x( Q5 Q
  27. Axis* axis1 = NULL;
    5 L" M: j( ?& ]' X' u' n/ p
  28. axis1 = cylinderBuilder1->Axis();8 n3 t( h1 ~' e( O+ z7 a( R
  29. axis1->Point()->SeTCoordinates(originPoint);  s" a6 ^4 Y, A6 S( B/ d! a5 ^
  30. axis1->SetDirection(direction1);</P>
    ; v" P( _+ @* _/ ]& W' Z
  31. <P>//Commit
    , W( |# l* T  x  l) O( ~/ |
  32. cylinderBuilder1->Commit();9 W- F2 W  T3 X* M/ D0 t
  33. cylinderBuilder1->Destroy();+ |& f" b9 B( G
  34. cylinderBuilder1 = NULL;# U6 K5 x. H2 ~- i3 x- }. f
  35. }
    + d4 o4 p1 l; J" \* f1 Y0 k' x. I
  36. </P>
复制代码
0 f- q: r" H  v9 d/ h
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了