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

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

[复制链接]

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

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

admin 楼主

2013-11-4 12:06:33

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

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

x
NX二次开发源码分享:NXOpen C++创建圆柱体特征
/ n, h; M1 _# `, [" j

  1.   A0 |8 K8 t3 ?" |0 k" G8 a8 e
  2. <P> </P>
复制代码

  1. 7 i8 q5 t+ G- R
  2. <P>void CreateCylinder_UsingUDB::CreateCylinder()
    ' k3 c5 c+ K& x7 |$ v+ M
  3. {
    ; f" ~7 @+ [% {( q
  4. Part* workPart(theSession->Parts()->Work());</P>
    - f9 k( J/ J6 M8 p
  5. <P>Features::CylinderBuilder* cylinderBuilder1 = NULL;/ X! Y- j! \6 E
  6. cylinderBuilder1 = workPart->Features()->CreateCylinderBuilder(NULL);</P>* N- C" i- S5 s
  7. <P>//Get the point! O$ M: V! O3 }& r6 p# a
  8. PropertyList* pointPropertyList = point0->GetProperties();
    7 c8 {! L* q6 Z( X1 G3 ?1 X7 a, G0 w+ ?
  9. Point3d originPoint = pointPropertyList->GetPoint("Point");
    # b9 ?% ]0 t! B3 U  n* O. j$ c
  10. delete pointPropertyList;+ F! W2 F6 z  d% y3 w4 `! s
  11. pointPropertyList = NULL;</P>
    7 w* Z+ Y: ^8 _3 k- {+ o
  12. <P>//Get the direction! M$ ^: |- q- M: Y3 C
  13. PropertyList* vectorPropertyList = vector0->GetProperties();
    ( i& j) }. Q- d2 i/ {* S0 O& `
  14. Vector3d direction = vectorPropertyList->GetVector("Vector");
    ) I' [0 H7 k. Y) Y
  15. delete vectorPropertyList;
    2 s* W& L9 N( R+ L7 ~3 M
  16. vectorPropertyList = NULL;</P>
    3 u: ^) k$ P7 D1 @/ R, w+ P
  17. <P>Direction* direction1 = NULL;; v7 }) \( z7 l
  18. direction1 = workPart->Directions()->CreateDirection(originPoint, direction, SmartObject::UpdateOptionWithinModeling);</P>" ~8 B& H1 g- I8 P$ l  m7 g
  19. <P>//Set diameter and height4 o  w  V0 r4 ~% s% P6 `
  20. std::stringstream diameterValue;; `* R+ h$ o% B% `4 Y  ]2 [
  21. diameterValue << diameter->GetValue();
    4 a2 G# b  O& l$ ^
  22. std::stringstream heightValue;1 J4 j& e2 f2 _7 \/ J
  23. heightValue << height->GetValue();</P>9 i7 @& R; N' y9 f# U# t0 v
  24. <P>cylinderBuilder1->Diameter()->SetRightHandSide(diameterValue.str());3 S4 k# j  d# s- V+ `0 Y
  25. cylinderBuilder1->Height()->SetRightHandSide(heightValue.str());</P>
    & Z  ]! G7 L! N; H
  26. <P>//Set the axis" l/ m: ^' G4 |+ p( J
  27. Axis* axis1 = NULL;& j7 B2 l: P+ J' D1 Q0 G; k: O
  28. axis1 = cylinderBuilder1->Axis();: q$ D* v8 g1 U. t: I  |) J
  29. axis1->Point()->SeTCoordinates(originPoint);/ h; H1 g& f3 _0 Z+ S! y
  30. axis1->SetDirection(direction1);</P>
    1 i4 G! a/ k+ R! D
  31. <P>//Commit! f# l8 C' s8 A  l# `+ v5 F
  32. cylinderBuilder1->Commit();/ [# {6 [  K. ^+ q, J
  33. cylinderBuilder1->Destroy();
    $ d) n1 z( W$ @' Y7 n
  34. cylinderBuilder1 = NULL;4 A+ `0 }; k; H$ v
  35. }
    . Q/ h: I# ]9 x
  36. </P>
复制代码
1 U" \$ _, W2 ]2 h- J
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了