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

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

[复制链接]

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

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

admin 楼主

2013-11-4 12:06:33

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

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

x
NX二次开发源码分享:NXOpen C++创建圆柱体特征' A# G4 C" C9 a" E% B8 y

  1. * U' j! o; F* o# |
  2. <P> </P>
复制代码

  1. ' X" Q  _* K$ y2 Y# [, M
  2. <P>void CreateCylinder_UsingUDB::CreateCylinder()1 n* E' p! M& G* z8 K( P
  3. {
    ( V5 E) P3 W& }( X/ f% L
  4. Part* workPart(theSession->Parts()->Work());</P>
    $ @: P1 j5 V6 ~5 N  W9 k
  5. <P>Features::CylinderBuilder* cylinderBuilder1 = NULL;
    & `3 y; N& ^  w% Z' m) g
  6. cylinderBuilder1 = workPart->Features()->CreateCylinderBuilder(NULL);</P>
    ; Z0 P0 j' w6 R/ g9 U- {8 w1 V
  7. <P>//Get the point$ q4 G/ I  g2 y* b, K
  8. PropertyList* pointPropertyList = point0->GetProperties();6 q0 j, G4 b2 e
  9. Point3d originPoint = pointPropertyList->GetPoint("Point");
    $ J# ~. g# }% I7 {: s: }
  10. delete pointPropertyList;
    5 o: T4 ^4 k- |. E
  11. pointPropertyList = NULL;</P>
      X8 s1 q+ d4 m1 n
  12. <P>//Get the direction  ~$ e8 \4 j. e& B. L
  13. PropertyList* vectorPropertyList = vector0->GetProperties();( |9 Z4 B( G# a* C1 [
  14. Vector3d direction = vectorPropertyList->GetVector("Vector");
    ) Z2 n3 l/ K- I8 m0 f3 b
  15. delete vectorPropertyList;
    - C& }1 `+ x/ T3 V: B1 L
  16. vectorPropertyList = NULL;</P>) }" L, J5 X" x$ j, Z
  17. <P>Direction* direction1 = NULL;
    1 _" T7 ?; l0 E# ?& i0 B3 f% ?
  18. direction1 = workPart->Directions()->CreateDirection(originPoint, direction, SmartObject::UpdateOptionWithinModeling);</P>' W& ]  U# j- o8 f' O
  19. <P>//Set diameter and height1 V; Y- |5 s: T: G
  20. std::stringstream diameterValue;
    - e9 r( _2 ]; p9 L8 n; m5 B& h  f7 J
  21. diameterValue << diameter->GetValue();/ R" s3 u* h4 J! W' O( w/ s
  22. std::stringstream heightValue;
    $ e2 H6 R% q1 m6 @# G! w. @# \
  23. heightValue << height->GetValue();</P>- u( @) u  P7 O  M4 F; l
  24. <P>cylinderBuilder1->Diameter()->SetRightHandSide(diameterValue.str());
    4 q1 h' `# s) }9 [# y' m& U
  25. cylinderBuilder1->Height()->SetRightHandSide(heightValue.str());</P>
    7 r$ T5 _" n4 d( Z) A
  26. <P>//Set the axis
      e. E5 g+ |5 J, M
  27. Axis* axis1 = NULL;6 k& T5 ^+ u' U) j! R
  28. axis1 = cylinderBuilder1->Axis();
    - D1 J2 M& j- B9 W8 Y- r1 Q: W
  29. axis1->Point()->SeTCoordinates(originPoint);
      G( k3 J2 Y3 J6 I% a
  30. axis1->SetDirection(direction1);</P># @3 H$ c. r/ x) R) I
  31. <P>//Commit0 Y5 Q; p; b6 B% ?( @1 k9 M* [, P
  32. cylinderBuilder1->Commit();. j0 K6 @# I) ?4 o
  33. cylinderBuilder1->Destroy();
    / L$ i$ J- \. F! A% V- N
  34. cylinderBuilder1 = NULL;
    ' c/ b8 f6 y. @3 F: D+ s
  35. }  p$ b  X5 T0 @1 H( e# L& `8 m
  36. </P>
复制代码
5 |& N7 ?- G4 p5 n/ ^, @! Y" u
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.diantuankj.com/ doTeam.tech
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 注册

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

    本网站(plmhome.com)为PLM之家工业软件学习官网站

    展示的视频材料全部免费,需要高清和特殊技术支持请联系 QQ: 939801026

    PLM之家NX CAM二次开发专题模块培训报名开始啦

    我知道了