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

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

[复制链接]

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

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

admin 楼主

2013-11-4 12:06:33

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

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

x
NX二次开发源码分享:NXOpen C++创建圆柱体特征
& T5 F) u( S- Q6 S
  1. ' {; o. e* O4 _! W. s: f
  2. <P> </P>
复制代码
  1. 7 v9 Z. R; h3 U3 N$ F' [8 W8 x
  2. <P>void CreateCylinder_UsingUDB::CreateCylinder()( E8 `5 c$ ]/ A, R
  3. {, I8 i4 Y* I' P/ `6 s$ r0 p
  4. Part* workPart(theSession->Parts()->Work());</P>+ X3 S  Y3 ?! Y4 R2 H
  5. <P>Features::CylinderBuilder* cylinderBuilder1 = NULL;6 [$ H1 z5 Z$ q. ~  p2 B
  6. cylinderBuilder1 = workPart->Features()->CreateCylinderBuilder(NULL);</P>
    1 z' U7 e) X( Y% u; J- w
  7. <P>//Get the point1 A% Z0 e! I. I
  8. PropertyList* pointPropertyList = point0->GetProperties();
    9 l# |% L7 }, b' G* S
  9. Point3d originPoint = pointPropertyList->GetPoint("Point");; s! U# e' _6 G8 |$ ]
  10. delete pointPropertyList;1 j' O3 y8 _- Z
  11. pointPropertyList = NULL;</P>3 x! {8 l4 T4 G
  12. <P>//Get the direction
    2 {; Y6 b  B* O1 p/ _9 N, U
  13. PropertyList* vectorPropertyList = vector0->GetProperties();
    8 R+ h/ [8 o) U2 p
  14. Vector3d direction = vectorPropertyList->GetVector("Vector");
    7 K2 D4 c4 M# W1 P+ B+ j$ Z4 \
  15. delete vectorPropertyList;
    9 y) c& u+ l% j# x# @) V" _- Q
  16. vectorPropertyList = NULL;</P>7 N$ _1 Y; W) e% Y! H  M
  17. <P>Direction* direction1 = NULL;, R: b: }. e, {) Z7 Z8 Y. \
  18. direction1 = workPart->Directions()->CreateDirection(originPoint, direction, SmartObject::UpdateOptionWithinModeling);</P>
    8 `+ ~) ?; D8 t( W8 ~5 O. L
  19. <P>//Set diameter and height
    % N! ?, f  k( q  z
  20. std::stringstream diameterValue;
    ( O$ f1 W( e$ f1 a, w8 s
  21. diameterValue << diameter->GetValue();7 V) r  Z/ N  F0 |1 Q
  22. std::stringstream heightValue;
    % B4 G$ a( s- g
  23. heightValue << height->GetValue();</P>
    " |- x* i3 q: q0 X2 k
  24. <P>cylinderBuilder1->Diameter()->SetRightHandSide(diameterValue.str());
    % u! N# O, P$ S  t1 H
  25. cylinderBuilder1->Height()->SetRightHandSide(heightValue.str());</P>6 \8 Y  b+ Q  z7 O
  26. <P>//Set the axis
    . a, N! J) ~. c
  27. Axis* axis1 = NULL;$ A, J- a! ?: N# H+ ~* q* F* K
  28. axis1 = cylinderBuilder1->Axis();
    ' y0 n9 U5 T3 `5 m, V! S- y! _2 u
  29. axis1->Point()->SeTCoordinates(originPoint);
    " T" m, R) S! X  ]7 k. K
  30. axis1->SetDirection(direction1);</P>/ i7 N! K( b$ V5 H2 ]1 V
  31. <P>//Commit# [; Z* C0 C4 D1 ^$ I
  32. cylinderBuilder1->Commit();
    6 _& `+ ^" W; O2 C& v0 ~
  33. cylinderBuilder1->Destroy();
    : `; e1 J) h( }4 A& P; f5 o5 z
  34. cylinderBuilder1 = NULL;
    0 `! y2 e. E2 z- E. H7 U
  35. }' `# y% Z4 D1 V
  36. </P>
复制代码

/ C4 w. S' M! r% J, m2 b
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了