PLM之家PLMHome-工业软件践行者

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

[复制链接]

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

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

admin 楼主

2013-11-4 12:06:33

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

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

x
NX二次开发源码分享:NXOpen C++创建圆柱体特征
" Y3 i% Q7 G8 \9 Z

  1. # D% c$ i. g( t3 H2 W* _
  2. <P> </P>
复制代码

  1. 8 J1 Y# Z5 G& B
  2. <P>void CreateCylinder_UsingUDB::CreateCylinder()
    6 d$ c4 T# m8 ?6 P% w# E! n
  3. {" V5 a; o  G4 g1 V2 T9 z  G5 H
  4. Part* workPart(theSession->Parts()->Work());</P>$ \9 J0 S) U/ [$ H3 t% ]0 q, G) B
  5. <P>Features::CylinderBuilder* cylinderBuilder1 = NULL;! g5 f; h( v, F
  6. cylinderBuilder1 = workPart->Features()->CreateCylinderBuilder(NULL);</P>5 t% {, s0 T6 r8 c& I
  7. <P>//Get the point+ t2 J* r/ k- E7 ?9 k
  8. PropertyList* pointPropertyList = point0->GetProperties();3 ^8 q' q' g. _# p2 @* q
  9. Point3d originPoint = pointPropertyList->GetPoint("Point");! v* ^* a  P* a( h) x8 U+ I6 U6 Q# v
  10. delete pointPropertyList;) b7 B0 J0 w$ G
  11. pointPropertyList = NULL;</P>) v0 O  w  P- ~
  12. <P>//Get the direction
    8 y' h: \% P9 e1 P& |, J! I
  13. PropertyList* vectorPropertyList = vector0->GetProperties();& S* G. k& b3 O
  14. Vector3d direction = vectorPropertyList->GetVector("Vector");
    " J4 l5 X$ ~% i. |
  15. delete vectorPropertyList;' M; q7 {8 o7 J& w# e# F0 A: o
  16. vectorPropertyList = NULL;</P>
    6 w/ d  u, Y) \) E8 g
  17. <P>Direction* direction1 = NULL;
    # G: f8 I+ K$ g6 l! r' a2 a
  18. direction1 = workPart->Directions()->CreateDirection(originPoint, direction, SmartObject::UpdateOptionWithinModeling);</P>
    % i2 j$ c% W* l$ W, E: q$ U# l( F
  19. <P>//Set diameter and height( _- H4 `0 C  H
  20. std::stringstream diameterValue;
    9 o' \2 E" l6 R, \* F# [# N9 K& ?
  21. diameterValue << diameter->GetValue();
    ' p3 i# T. ~6 j9 b! ?! @1 `9 L8 M
  22. std::stringstream heightValue;
    : i. o& j: J0 G3 ?
  23. heightValue << height->GetValue();</P>
    . h& g& _( L, l( C' t( Z
  24. <P>cylinderBuilder1->Diameter()->SetRightHandSide(diameterValue.str());
    3 h" f4 \) K7 ?
  25. cylinderBuilder1->Height()->SetRightHandSide(heightValue.str());</P>+ h! N$ i1 B$ E7 e( C4 D/ ~
  26. <P>//Set the axis
    , k0 Q& \# d' q$ A+ H/ r" m
  27. Axis* axis1 = NULL;
    . l3 ~! w+ x9 ?! g: c! q
  28. axis1 = cylinderBuilder1->Axis();: d3 y9 q* q: H, z5 n5 R
  29. axis1->Point()->SeTCoordinates(originPoint);
    0 f9 c% Z* y6 {/ Z% X
  30. axis1->SetDirection(direction1);</P>
    1 s8 b. i. P9 j+ R- `
  31. <P>//Commit0 H2 [, s+ ]0 X" V( b+ J# R
  32. cylinderBuilder1->Commit();
    & x7 d2 N& s9 Z- z: `& K
  33. cylinderBuilder1->Destroy();( p' z1 |- x: p, {5 o
  34. cylinderBuilder1 = NULL;4 @% _: R3 d  }# [0 H$ k- w
  35. }
    - U+ w* E( V# L
  36. </P>
复制代码

& Z" J5 }( R6 g3 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二次开发专题模块培训报名开始啦

    我知道了