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

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

[复制链接]

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

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

admin 楼主

2013-11-4 12:06:33

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

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

x
NX二次开发源码分享:NXOpen C++创建圆柱体特征! c% J& K* D6 I9 b: }' _

  1. ' v& E: A, ]& H0 P; t
  2. <P> </P>
复制代码

  1. + P0 G8 t! {) w' W! n) Z, J' J
  2. <P>void CreateCylinder_UsingUDB::CreateCylinder()2 v& f+ L0 J3 M/ \, N" L! `
  3. {
    : {: t# k) ?6 ?  t
  4. Part* workPart(theSession->Parts()->Work());</P>
    ) j/ b7 I, e0 `- U: H3 P  f
  5. <P>Features::CylinderBuilder* cylinderBuilder1 = NULL;
    : y7 k  t# d% G
  6. cylinderBuilder1 = workPart->Features()->CreateCylinderBuilder(NULL);</P>2 k( b. s+ p' p) V/ h
  7. <P>//Get the point
    % s! g# W6 X: H+ L
  8. PropertyList* pointPropertyList = point0->GetProperties();6 x) S8 H% N/ J* h  I- l9 H+ r$ c- d
  9. Point3d originPoint = pointPropertyList->GetPoint("Point");% g* p4 F% q$ x; w4 f
  10. delete pointPropertyList;; ?5 E6 Z& P9 X- ~, N4 d
  11. pointPropertyList = NULL;</P>
    # {3 s: ^: b: g' P) X; k
  12. <P>//Get the direction
    5 z2 u* t6 F4 o0 E' H
  13. PropertyList* vectorPropertyList = vector0->GetProperties();
    ( e/ F, p. D) R% h1 J+ e
  14. Vector3d direction = vectorPropertyList->GetVector("Vector");
      ^& _! U1 @" H0 V
  15. delete vectorPropertyList;
    8 k8 s* O, N9 l4 t
  16. vectorPropertyList = NULL;</P>
    , L  y2 J1 |+ S' }
  17. <P>Direction* direction1 = NULL;
    9 {. X& j" b$ H$ \. J$ A
  18. direction1 = workPart->Directions()->CreateDirection(originPoint, direction, SmartObject::UpdateOptionWithinModeling);</P>
    9 n! @& B7 U# b6 J9 ^) R. E
  19. <P>//Set diameter and height- D. u% I$ _$ G+ d
  20. std::stringstream diameterValue;
    7 T4 f# |7 V$ L7 \0 q
  21. diameterValue << diameter->GetValue();1 M6 F6 E( l3 Z1 \
  22. std::stringstream heightValue;  n! k; c; O5 ?
  23. heightValue << height->GetValue();</P>. O' T+ F' a3 W! v1 D3 p
  24. <P>cylinderBuilder1->Diameter()->SetRightHandSide(diameterValue.str());
    ! y2 E8 Y( B3 E' V4 k" i
  25. cylinderBuilder1->Height()->SetRightHandSide(heightValue.str());</P>
    $ s; V5 T2 M7 e) S$ T3 p" B
  26. <P>//Set the axis! }9 W. r1 z. N9 J0 e8 |  Z1 B' g
  27. Axis* axis1 = NULL;
    $ q: `' F* h& s2 W* \. _  b
  28. axis1 = cylinderBuilder1->Axis();8 S- S& v5 S9 G4 U2 z- m, A
  29. axis1->Point()->SeTCoordinates(originPoint);
    % P* F( O  g7 z5 Y  y; u
  30. axis1->SetDirection(direction1);</P>
    6 R9 O: K8 I' Q8 G
  31. <P>//Commit# I3 ]1 t* b/ c- A3 b
  32. cylinderBuilder1->Commit();: b3 }1 v! g  d2 U
  33. cylinderBuilder1->Destroy();4 ]* b& P  k# `8 N! @
  34. cylinderBuilder1 = NULL;
    5 n) t: ?# x; A% ~
  35. }- V9 b9 {8 K6 C6 q* P: H3 V
  36. </P>
复制代码

* p( u+ Q. ]6 g6 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二次开发专题模块培训报名开始啦

    我知道了