PLM之家PLMHome-工业软件与AI结合践行者

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

[复制链接]

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

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

admin 楼主

2013-11-4 12:06:33

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

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

x
NX二次开发源码分享:NXOpen C++创建圆柱体特征1 y3 U" ]8 Q) Q. z; Y
  1.   i$ A& F, i. Y: z
  2. <P> </P>
复制代码

  1. ' ]/ r3 P9 @8 U) ]: q
  2. <P>void CreateCylinder_UsingUDB::CreateCylinder()5 W/ r: ?( K5 [- H' J
  3. {
    2 V8 |( H& ]4 t+ _
  4. Part* workPart(theSession->Parts()->Work());</P>$ a5 i/ i) p- c# h
  5. <P>Features::CylinderBuilder* cylinderBuilder1 = NULL;
    ! Z; B, P) f4 |  Z2 U# H1 r
  6. cylinderBuilder1 = workPart->Features()->CreateCylinderBuilder(NULL);</P>
    * {6 H* V, w; l0 n: r
  7. <P>//Get the point; ~2 w9 L/ C# J' [9 E
  8. PropertyList* pointPropertyList = point0->GetProperties();6 _  m) a" t6 i& ]8 Y
  9. Point3d originPoint = pointPropertyList->GetPoint("Point");% N. H/ [0 F$ j8 i7 e% n! t
  10. delete pointPropertyList;
    4 S( W! Z7 y" {3 ~( b; q7 A# O
  11. pointPropertyList = NULL;</P>
    ) G2 ?5 ~, p% L% V0 r+ X
  12. <P>//Get the direction
    4 A/ o9 @$ \1 }( V0 q: w0 x/ f  r( c
  13. PropertyList* vectorPropertyList = vector0->GetProperties();' Y/ X: w8 B( Q7 v
  14. Vector3d direction = vectorPropertyList->GetVector("Vector");
    ' n5 Y0 u! j( C& y1 c% Z
  15. delete vectorPropertyList;4 g2 e) c' Y4 f3 Q2 i; Q
  16. vectorPropertyList = NULL;</P>
    7 Y) [7 ]8 ?; @" K3 J/ I- J
  17. <P>Direction* direction1 = NULL;3 G9 r: b# s# A* p% Q
  18. direction1 = workPart->Directions()->CreateDirection(originPoint, direction, SmartObject::UpdateOptionWithinModeling);</P>- F  }: T3 b4 E& t7 f. P
  19. <P>//Set diameter and height
    1 Z5 _/ O  R  A! B
  20. std::stringstream diameterValue;
    : \6 U! D& f. y" s; y0 E- x3 @; h
  21. diameterValue << diameter->GetValue();
    4 \8 |7 T9 x' r/ j
  22. std::stringstream heightValue;
    " r, z+ ^1 R5 N
  23. heightValue << height->GetValue();</P>
    : u/ s% @1 J  L- p4 p. |+ Y5 y8 i9 e
  24. <P>cylinderBuilder1->Diameter()->SetRightHandSide(diameterValue.str());7 x* \/ R/ C* n2 h
  25. cylinderBuilder1->Height()->SetRightHandSide(heightValue.str());</P>- x' _( F& H3 J# u9 u
  26. <P>//Set the axis
    * n* @4 T/ f/ O+ X8 L
  27. Axis* axis1 = NULL;
    ' E4 z( G' v  w/ P& u  K% k* u3 e3 T
  28. axis1 = cylinderBuilder1->Axis();3 F0 x9 Q6 d& `; q
  29. axis1->Point()->SeTCoordinates(originPoint);  L9 m2 A4 @2 s- n- v8 `; I! s7 y, p
  30. axis1->SetDirection(direction1);</P>4 k0 p  X5 x" ?, ]) v3 Q
  31. <P>//Commit1 o2 Y. @3 y" ]
  32. cylinderBuilder1->Commit();0 {1 U0 N' k- l5 f& ?+ B' Q. _
  33. cylinderBuilder1->Destroy();: t& c; ?( d4 k* j
  34. cylinderBuilder1 = NULL;0 N1 P. r& N) A& W" c( |, O* J, z, Q
  35. }
    # y& c6 h9 v3 V" u5 |0 y
  36. </P>
复制代码
* f& g9 L  M* E9 \& b8 ?
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了