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

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

[复制链接]

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

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

admin 楼主

2013-11-4 12:06:33

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

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

x
NX二次开发源码分享:NXOpen C++创建圆柱体特征( _! R; t) O' q: V* R
  1. 7 r/ Y! b+ J% @) ~# f
  2. <P> </P>
复制代码

  1. # r$ [) J! M+ D
  2. <P>void CreateCylinder_UsingUDB::CreateCylinder()# ~9 U: `& B+ r* r- a% o& M$ c
  3. {
    5 _4 a' k' h$ N% L$ v
  4. Part* workPart(theSession->Parts()->Work());</P>
    * N" H0 B* r6 c
  5. <P>Features::CylinderBuilder* cylinderBuilder1 = NULL;
    . m! t6 A( E1 B5 v
  6. cylinderBuilder1 = workPart->Features()->CreateCylinderBuilder(NULL);</P># ^& M1 L* h. t
  7. <P>//Get the point
    0 Q/ x6 O! S3 _5 q  [6 w
  8. PropertyList* pointPropertyList = point0->GetProperties();$ j7 k# F! N+ P5 ?
  9. Point3d originPoint = pointPropertyList->GetPoint("Point");
      T3 q! X) j0 i, [' A
  10. delete pointPropertyList;! v4 g7 W. j( j; E. L; ?4 O. N
  11. pointPropertyList = NULL;</P>
    * _8 P3 b$ a7 ^
  12. <P>//Get the direction. w6 M6 h. L: k# p9 c% o! p
  13. PropertyList* vectorPropertyList = vector0->GetProperties();) b; c# U; A" f7 w3 I  U
  14. Vector3d direction = vectorPropertyList->GetVector("Vector");
    " }- X( C0 _# m1 |2 c0 @) e, B
  15. delete vectorPropertyList;3 @% B& I$ V2 |$ a5 l
  16. vectorPropertyList = NULL;</P>
    7 z* y; z. d( W# m/ T! Z
  17. <P>Direction* direction1 = NULL;
    3 r4 w& C- R0 q7 G: i9 ~  T& F
  18. direction1 = workPart->Directions()->CreateDirection(originPoint, direction, SmartObject::UpdateOptionWithinModeling);</P>
    0 D" M0 I! K8 k6 M+ g# G
  19. <P>//Set diameter and height' d/ v0 V! v( e1 B
  20. std::stringstream diameterValue;3 s& f  v7 ~1 B' x4 c7 o( i, G
  21. diameterValue << diameter->GetValue();5 f3 f! p& `  C( u- F7 G
  22. std::stringstream heightValue;
    , `% T$ |  x0 g6 d
  23. heightValue << height->GetValue();</P>7 W: v2 k1 Q* {, S; p: \
  24. <P>cylinderBuilder1->Diameter()->SetRightHandSide(diameterValue.str());+ |: h& ^. ?# C$ |  p
  25. cylinderBuilder1->Height()->SetRightHandSide(heightValue.str());</P>
    $ @0 ?% t/ P1 s% K
  26. <P>//Set the axis" n& _0 r  D1 k% ]$ }- ]+ y
  27. Axis* axis1 = NULL;, W! d: p' G! `2 v3 e
  28. axis1 = cylinderBuilder1->Axis();1 N/ L2 U) f/ A5 ]
  29. axis1->Point()->SeTCoordinates(originPoint);. s% R; G' S  W! E
  30. axis1->SetDirection(direction1);</P>
    % L2 q1 m. q4 O5 q. V
  31. <P>//Commit
      l* [, D& N+ I) `& g  N0 |: x9 z
  32. cylinderBuilder1->Commit();
    ( t6 ?3 r1 h1 q4 w
  33. cylinderBuilder1->Destroy();
    7 j* [) Q- g# y6 h5 a" o" A
  34. cylinderBuilder1 = NULL;
    1 d* @/ ^  n0 g1 |* y- k
  35. }
    8 a5 L# _0 R4 o& z6 Z
  36. </P>
复制代码

  L( V' `% n% R, T
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了