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

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

[复制链接]

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

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

admin 楼主

2013-11-4 12:06:33

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

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

x
NX二次开发源码分享:NXOpen C++创建圆柱体特征
4 s+ a; |( ?1 O- U/ d, e
  1. 9 |3 u' X* c8 A- W
  2. <P> </P>
复制代码

  1. 6 ?4 d5 x" V. H4 V+ s3 v' w3 b$ `
  2. <P>void CreateCylinder_UsingUDB::CreateCylinder()# v5 {" A6 P* N% }- i' X; V# J
  3. {
    - i! Y9 S( J: L4 c  g& u
  4. Part* workPart(theSession->Parts()->Work());</P>
    ; h8 ~# ?, a3 M3 X- G
  5. <P>Features::CylinderBuilder* cylinderBuilder1 = NULL;6 Y3 U  f( i# ~7 f. T) Y5 x
  6. cylinderBuilder1 = workPart->Features()->CreateCylinderBuilder(NULL);</P>; p6 t$ W, B  p7 ^; Q# o: @' M
  7. <P>//Get the point! Q% E- V4 U) O- Q; U- O( O% L/ @- J
  8. PropertyList* pointPropertyList = point0->GetProperties();- F9 L1 X8 Q/ X
  9. Point3d originPoint = pointPropertyList->GetPoint("Point");
    : }) H8 Z; I) d& `; D$ P
  10. delete pointPropertyList;. }9 W5 O2 j) [4 M3 ~
  11. pointPropertyList = NULL;</P>" W# I" v8 K/ Q1 C' p3 G& g( R
  12. <P>//Get the direction0 e& r' v& [2 B2 `" h
  13. PropertyList* vectorPropertyList = vector0->GetProperties();+ m( a3 A' u9 o
  14. Vector3d direction = vectorPropertyList->GetVector("Vector");
    - A" X; l1 Q, t$ V. h0 G$ V
  15. delete vectorPropertyList;
    3 `* q6 c0 J6 l# B- ~/ [
  16. vectorPropertyList = NULL;</P>5 k" G5 a# f) X& I& q
  17. <P>Direction* direction1 = NULL;
    3 l" O( w6 X2 A: U  y
  18. direction1 = workPart->Directions()->CreateDirection(originPoint, direction, SmartObject::UpdateOptionWithinModeling);</P>* d4 E6 k- `5 }! O$ O( f
  19. <P>//Set diameter and height
    ) t& {. j$ |3 C7 @8 u" g* J3 y
  20. std::stringstream diameterValue;" l$ o, a6 J7 B) K3 d8 D' W" z) _
  21. diameterValue << diameter->GetValue();
    * {$ l8 _2 a  z& }+ n7 C6 s3 I
  22. std::stringstream heightValue;
    7 F. F$ C# b- _1 @
  23. heightValue << height->GetValue();</P>
    8 k& l! y) w/ B+ ]
  24. <P>cylinderBuilder1->Diameter()->SetRightHandSide(diameterValue.str());- n1 w$ b9 @1 j+ }+ {2 t
  25. cylinderBuilder1->Height()->SetRightHandSide(heightValue.str());</P>
    % I- G7 K' T6 a6 a! E! x
  26. <P>//Set the axis% ^. f! `3 K9 ~$ Q% @, J2 `' w1 ~
  27. Axis* axis1 = NULL;4 T) u% l5 ~7 |, I% l! J
  28. axis1 = cylinderBuilder1->Axis();: f7 B6 \6 i2 Q& {
  29. axis1->Point()->SeTCoordinates(originPoint);. g5 M7 T) D/ T/ }$ t* L' F
  30. axis1->SetDirection(direction1);</P>$ Q2 b; b6 G9 n" v. G& F
  31. <P>//Commit
    ; Q% s0 b) M: b3 o& _
  32. cylinderBuilder1->Commit();) M" I" M- Z& o1 K
  33. cylinderBuilder1->Destroy();: A8 d+ S. l- }
  34. cylinderBuilder1 = NULL;' X+ i9 R. o/ ?* z! @; t
  35. }
    & n% b  s# @4 z  q% j& s. i
  36. </P>
复制代码
% l+ z9 }1 s! \% `& O6 E. i& z
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了