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

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

[复制链接]

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

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

admin 楼主

2013-11-4 12:06:33

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

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

x
NX二次开发源码分享:NXOpen C++创建圆柱体特征" D% {0 n$ F/ {; D+ C4 k, Z6 k
  1. . F+ f- N3 F# t* \8 m" a
  2. <P> </P>
复制代码
  1. $ e1 v+ `; O* n
  2. <P>void CreateCylinder_UsingUDB::CreateCylinder()- f& b7 ~; W& o& H" o7 U9 d/ b4 U
  3. {
    3 P& t7 I. \5 D7 R' L
  4. Part* workPart(theSession->Parts()->Work());</P>
    ! R- g* b1 L: H5 d* b
  5. <P>Features::CylinderBuilder* cylinderBuilder1 = NULL;: T% x+ K$ y& n+ z6 k7 N7 l$ }0 j9 U
  6. cylinderBuilder1 = workPart->Features()->CreateCylinderBuilder(NULL);</P>0 N. V; ?2 V; K) X5 b/ h
  7. <P>//Get the point
    ' v$ c- S' }2 L( Z- x4 L
  8. PropertyList* pointPropertyList = point0->GetProperties();
    ( _2 j/ y+ g3 _' R0 x) p' s
  9. Point3d originPoint = pointPropertyList->GetPoint("Point");
    - R2 d1 b! N2 d$ Q' z  T: B
  10. delete pointPropertyList;4 }# V* y/ Y$ u2 _) C
  11. pointPropertyList = NULL;</P>
    6 U2 L4 M+ o' I* H: H
  12. <P>//Get the direction
    + b. \/ V# F# n$ C! U4 `: I& K
  13. PropertyList* vectorPropertyList = vector0->GetProperties();4 ~# J  p& y( m9 T
  14. Vector3d direction = vectorPropertyList->GetVector("Vector");
    + i, o6 H* }4 W$ i
  15. delete vectorPropertyList;
    # [( |( y! H, Z. l0 }$ j
  16. vectorPropertyList = NULL;</P>
    & Q+ K3 R, v) p- o7 b
  17. <P>Direction* direction1 = NULL;' P$ k6 `! y6 s
  18. direction1 = workPart->Directions()->CreateDirection(originPoint, direction, SmartObject::UpdateOptionWithinModeling);</P>$ _/ Y+ O, I2 K7 J+ O
  19. <P>//Set diameter and height
    , M4 v) [; ?4 C+ |# P" X+ j) f- a' \" G
  20. std::stringstream diameterValue;
    9 P! W1 G: X- o( [% g( V  g2 r. j
  21. diameterValue << diameter->GetValue();
    3 c$ _9 s+ g' H: ]+ l
  22. std::stringstream heightValue;
    $ l# }# d5 g, K& f+ y5 U  z+ V
  23. heightValue << height->GetValue();</P>
    7 L1 u+ W! W: R( e
  24. <P>cylinderBuilder1->Diameter()->SetRightHandSide(diameterValue.str());
    : j5 j% G6 O& c% v) y1 R5 l! J
  25. cylinderBuilder1->Height()->SetRightHandSide(heightValue.str());</P>4 e! s1 n! R$ a+ U  t) v
  26. <P>//Set the axis
    " N+ k7 ^$ x! z
  27. Axis* axis1 = NULL;3 X1 m2 N- k+ ]
  28. axis1 = cylinderBuilder1->Axis();
    & c( Y8 d0 d' s' E7 l- z; n
  29. axis1->Point()->SeTCoordinates(originPoint);
    0 d! f' b- b/ z4 @' q% S- b
  30. axis1->SetDirection(direction1);</P>
    + w2 M. X8 ^! J' [* K
  31. <P>//Commit
    " D7 i  V# ~0 v& |
  32. cylinderBuilder1->Commit();
    # C4 y, u+ p* E
  33. cylinderBuilder1->Destroy();0 @5 r4 n# z# y/ \: m# |. W
  34. cylinderBuilder1 = NULL;
    ! b$ V9 G5 B1 Z% K3 q1 M8 P7 ~. Y; S" g
  35. }
    8 H8 L+ M8 r2 M1 f9 q# i9 m8 ]
  36. </P>
复制代码

' q' `# h' }- E/ A
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了