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

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

[复制链接]

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

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

admin 楼主

2013-11-4 12:06:33

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

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

x
NX二次开发源码分享:NXOpen C++创建圆柱体特征
6 ]3 u: M" u+ y1 O) \4 N
  1. ( _7 |3 C1 A0 O* `- \& s# ~
  2. <P> </P>
复制代码
  1. * n8 I% X6 C( z$ b! p# ]' K% \! e
  2. <P>void CreateCylinder_UsingUDB::CreateCylinder()7 q* B2 y! C1 z7 I( P
  3. {8 j2 ^4 b: N9 G# t( \5 J$ z
  4. Part* workPart(theSession->Parts()->Work());</P>4 {8 v0 i: ^  h$ n
  5. <P>Features::CylinderBuilder* cylinderBuilder1 = NULL;! [* }7 i. v" }, u* M  ?& c) i
  6. cylinderBuilder1 = workPart->Features()->CreateCylinderBuilder(NULL);</P>$ [/ P5 \, v( s; ]  A
  7. <P>//Get the point; K, b( ?, n& h, F$ }6 }
  8. PropertyList* pointPropertyList = point0->GetProperties();( w" K* X$ y9 ^8 \8 W' }
  9. Point3d originPoint = pointPropertyList->GetPoint("Point");- X/ h% Q* E* N# n/ D
  10. delete pointPropertyList;7 N5 Z3 I* u7 F+ d
  11. pointPropertyList = NULL;</P>
    ; l2 E( ~" \, w* [8 v- y( b- C
  12. <P>//Get the direction1 ]& ^7 u& X2 w4 H
  13. PropertyList* vectorPropertyList = vector0->GetProperties();
    & X( C# ^! I3 ?
  14. Vector3d direction = vectorPropertyList->GetVector("Vector");
    ) u# k2 S; m, ~
  15. delete vectorPropertyList;
    & n4 [; _! F, {
  16. vectorPropertyList = NULL;</P>
    $ J. {% R0 }" N# j
  17. <P>Direction* direction1 = NULL;
    . E7 z" E2 v0 Q  R
  18. direction1 = workPart->Directions()->CreateDirection(originPoint, direction, SmartObject::UpdateOptionWithinModeling);</P>( L0 v+ @4 `3 R2 Z8 Z8 Y6 X: c
  19. <P>//Set diameter and height* v# Y+ t7 A- `, {
  20. std::stringstream diameterValue;  `7 w, f$ g8 E
  21. diameterValue << diameter->GetValue();
    1 H& p( l) F4 k7 \3 s
  22. std::stringstream heightValue;
    9 Q0 k; F! i6 s
  23. heightValue << height->GetValue();</P>
    & i9 {+ u0 V. Z; f
  24. <P>cylinderBuilder1->Diameter()->SetRightHandSide(diameterValue.str());
      E1 ~/ H3 `/ O
  25. cylinderBuilder1->Height()->SetRightHandSide(heightValue.str());</P>* _. c' \0 i" G4 F0 z
  26. <P>//Set the axis5 I" I. ?% U# H; ~" Z0 H4 E
  27. Axis* axis1 = NULL;
    . P$ l7 J% F3 Q/ t; p7 Z
  28. axis1 = cylinderBuilder1->Axis();/ Y; Y6 y1 Y  F  T3 {3 X
  29. axis1->Point()->SeTCoordinates(originPoint);
    5 W' z% q7 o% e4 e5 y1 j0 D  u
  30. axis1->SetDirection(direction1);</P>5 R/ t9 P' l& O: ]. i5 L% s5 i7 G( r
  31. <P>//Commit$ t# C$ n8 }3 ]( }: l
  32. cylinderBuilder1->Commit();- _$ V5 W- f# P' j$ I2 q  h
  33. cylinderBuilder1->Destroy();
    5 o) e0 B, g  ~( s+ w7 ]
  34. cylinderBuilder1 = NULL;
    ! Z9 z8 ^* h+ M6 v' q5 G, z: K6 E- [
  35. }
    * [# q- p: r; o7 c$ |" n: O& ^
  36. </P>
复制代码
$ O! O8 b1 f3 w6 w* @
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了