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

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

[复制链接]

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

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

admin 楼主

2013-11-4 12:06:33

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

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

x
NX二次开发源码分享:NXOpen C++创建圆柱体特征
) B8 Q7 S0 e' r" e
  1. + u" o& z0 @# t% N. c
  2. <P> </P>
复制代码
  1. ! k8 w* S3 H& j# L/ E
  2. <P>void CreateCylinder_UsingUDB::CreateCylinder()+ K6 C- i& t, r& g( o
  3. {
    6 `. C7 U3 B2 E( s" n) p
  4. Part* workPart(theSession->Parts()->Work());</P>
    : q. h# m; {- Y9 c# C' Q% M6 s% P
  5. <P>Features::CylinderBuilder* cylinderBuilder1 = NULL;7 u# s4 K. P% I  f
  6. cylinderBuilder1 = workPart->Features()->CreateCylinderBuilder(NULL);</P>
    + o0 Z" ~, Q) {" ~3 ?1 K6 D0 G
  7. <P>//Get the point
    1 w- L. Y$ E" O/ j6 T  q
  8. PropertyList* pointPropertyList = point0->GetProperties();' s. a0 H  [1 M5 z1 w
  9. Point3d originPoint = pointPropertyList->GetPoint("Point");
    ' V  `. _7 E( i" G0 ?$ g1 z
  10. delete pointPropertyList;
    2 d: F! D6 v: G: Y* ?6 I2 {
  11. pointPropertyList = NULL;</P>& _5 y  N5 s; S+ H8 z: r
  12. <P>//Get the direction1 B( U$ B# i  [* B) [6 _
  13. PropertyList* vectorPropertyList = vector0->GetProperties();. B* C! s8 i" j1 A4 R8 d
  14. Vector3d direction = vectorPropertyList->GetVector("Vector");& a) u$ |' F9 ?2 s2 k/ E
  15. delete vectorPropertyList;
    ) j: u% S6 [5 G& G6 S
  16. vectorPropertyList = NULL;</P>
    : q. i8 {5 D* e2 {" p
  17. <P>Direction* direction1 = NULL;0 Q. v5 C% t6 B5 w8 a) o- d
  18. direction1 = workPart->Directions()->CreateDirection(originPoint, direction, SmartObject::UpdateOptionWithinModeling);</P>* n8 N3 c+ _, c& H  ~
  19. <P>//Set diameter and height
    ) ~) g9 m% p  B0 m
  20. std::stringstream diameterValue;
    4 j  w4 }7 \) K1 p6 w
  21. diameterValue << diameter->GetValue();
    ! g6 W  q6 b; S$ w2 Q) v
  22. std::stringstream heightValue;5 T- y* A; t$ r3 J+ A  |: a
  23. heightValue << height->GetValue();</P># q5 w. I9 d, u" c. D: z1 H" S, O
  24. <P>cylinderBuilder1->Diameter()->SetRightHandSide(diameterValue.str());) Z3 p8 D/ Z" ^* n/ h
  25. cylinderBuilder1->Height()->SetRightHandSide(heightValue.str());</P>
    - c7 n' T, @8 i  o3 |: U
  26. <P>//Set the axis" Z$ H# T: p9 _7 K/ O
  27. Axis* axis1 = NULL;: g; k& A. y  E/ K5 G
  28. axis1 = cylinderBuilder1->Axis();
    / T; K% ?# i% Q) Y
  29. axis1->Point()->SeTCoordinates(originPoint);3 P* e( z; @  M
  30. axis1->SetDirection(direction1);</P>$ m% g' v. ^4 F7 W6 K! G2 |4 t  ?* U( ^
  31. <P>//Commit
    # t- K! u  J. L* X( t5 Q$ Z
  32. cylinderBuilder1->Commit();% w# @; M' }& @! q' \; @
  33. cylinderBuilder1->Destroy();
    7 p4 t9 \, T  m# P; B
  34. cylinderBuilder1 = NULL;6 g) a  ?9 U& `/ [* q, J
  35. }" |# @7 G. S! f. k/ {" U# c, a
  36. </P>
复制代码
" {' t4 d! M6 S' t! b% R) }' [
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了