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

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

[复制链接]

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

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

admin 楼主

2013-11-4 12:06:33

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

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

x
NX二次开发源码分享:NXOpen C++创建圆柱体特征
* n% f; s; f( Q+ l
  1. 5 ]$ h$ c- }1 {
  2. <P> </P>
复制代码
  1. , z# D: w6 Q2 H, O/ Z
  2. <P>void CreateCylinder_UsingUDB::CreateCylinder()
    8 t. R& m5 X3 v6 E# g
  3. {' o$ ~! `9 T* y4 X
  4. Part* workPart(theSession->Parts()->Work());</P>0 |/ J% {$ @- o3 F+ G. s
  5. <P>Features::CylinderBuilder* cylinderBuilder1 = NULL;8 L& Z* n0 i3 ^6 E0 l1 |  D
  6. cylinderBuilder1 = workPart->Features()->CreateCylinderBuilder(NULL);</P>& L( U1 k/ H" J3 c3 R/ |7 v
  7. <P>//Get the point2 c1 ~; Y9 J7 `# M& \' e) x6 h
  8. PropertyList* pointPropertyList = point0->GetProperties();
    , \9 }( U; |/ d; C6 P8 Q7 q* v4 V8 v
  9. Point3d originPoint = pointPropertyList->GetPoint("Point");
    8 `) S3 M, h+ ^) p
  10. delete pointPropertyList;
    + J* ?8 ?* E$ u% i" d8 M) r. M6 E
  11. pointPropertyList = NULL;</P>! n# `; `# s( [# _7 _
  12. <P>//Get the direction
    % {1 J1 w* `# X/ j6 l2 Y" a
  13. PropertyList* vectorPropertyList = vector0->GetProperties();
    / v, d2 O1 ~4 `  H
  14. Vector3d direction = vectorPropertyList->GetVector("Vector");0 c& M0 G& V7 Q7 Z5 t7 E
  15. delete vectorPropertyList;
    * g- U% X& [% @# f- r
  16. vectorPropertyList = NULL;</P>2 p- X4 ~0 M# B1 I8 t* _' a
  17. <P>Direction* direction1 = NULL;3 D+ `/ H0 _! D+ E9 o( \( i
  18. direction1 = workPart->Directions()->CreateDirection(originPoint, direction, SmartObject::UpdateOptionWithinModeling);</P>
    ! L% f9 |. R) C: Y
  19. <P>//Set diameter and height5 u$ d5 |7 n5 W# g
  20. std::stringstream diameterValue;
    5 ^9 c% p7 K8 N! T" U. r
  21. diameterValue << diameter->GetValue();
    ' M) y  [; A3 W
  22. std::stringstream heightValue;
    ' z% Z% F' F. f; [
  23. heightValue << height->GetValue();</P>
    8 {# }" F& i3 o( |6 G; O
  24. <P>cylinderBuilder1->Diameter()->SetRightHandSide(diameterValue.str());* @2 Z2 y4 Q; {# `3 q, [
  25. cylinderBuilder1->Height()->SetRightHandSide(heightValue.str());</P>3 O4 {/ w  O9 ~
  26. <P>//Set the axis" }) B. @- m7 {& B6 y3 P  m8 r) |
  27. Axis* axis1 = NULL;
    8 i5 i+ v" T; b: f5 K/ ]6 i
  28. axis1 = cylinderBuilder1->Axis();
    , w' s1 J' z- a% G9 q
  29. axis1->Point()->SeTCoordinates(originPoint);/ O  D. \# R& Q% w3 c' m7 |+ W
  30. axis1->SetDirection(direction1);</P>
    ) G/ `; u: s9 p+ x& d
  31. <P>//Commit5 [; p" g( R3 ^
  32. cylinderBuilder1->Commit();
    # D  q/ c6 G; j1 o  ?6 L8 c# k
  33. cylinderBuilder1->Destroy();
    6 l; Z: A+ r( Y6 u2 R) ^
  34. cylinderBuilder1 = NULL;7 S7 e" G( w0 G) l9 e
  35. }5 }+ }& g) o/ n* I& `0 T" o$ N+ J
  36. </P>
复制代码

4 H  f0 Q) ?  {3 V9 M+ H
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了