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

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

[复制链接]

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

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

admin 楼主

2013-11-4 12:06:33

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

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

x
NX二次开发源码分享:NXOpen C++创建圆柱体特征) q2 s: G% ]/ c1 ?: k" N% ~
  1. ( H) Q' a8 L' p5 T! G
  2. <P> </P>
复制代码

  1. + O  c; d  j  h7 m8 F9 p/ g6 t
  2. <P>void CreateCylinder_UsingUDB::CreateCylinder()$ o0 K- o9 t/ [- l9 M$ }
  3. {, s2 B* @- F3 c5 r" r0 [/ w
  4. Part* workPart(theSession->Parts()->Work());</P>% o: A, M; ~4 X4 V1 \' \" J
  5. <P>Features::CylinderBuilder* cylinderBuilder1 = NULL;
    * r3 T0 e, a, w* }# N
  6. cylinderBuilder1 = workPart->Features()->CreateCylinderBuilder(NULL);</P>
    % |# V  d  d. `& b6 ~. l6 R
  7. <P>//Get the point, e+ I2 P  k& @+ S; k
  8. PropertyList* pointPropertyList = point0->GetProperties();8 Z/ N% w0 N! D3 c8 E8 ^
  9. Point3d originPoint = pointPropertyList->GetPoint("Point");
    ! n* m& t& E2 @. w6 A8 e* k1 c
  10. delete pointPropertyList;
    7 c) `' w$ A; V2 Y4 G
  11. pointPropertyList = NULL;</P>
    9 g& q- C+ }7 {5 S
  12. <P>//Get the direction3 g7 `9 m2 x! N
  13. PropertyList* vectorPropertyList = vector0->GetProperties();' ?0 T2 s& M6 m: \
  14. Vector3d direction = vectorPropertyList->GetVector("Vector");
    + x9 |' ^) v1 K4 t+ d
  15. delete vectorPropertyList;5 y. A9 l, F! Y; U+ w8 N6 t
  16. vectorPropertyList = NULL;</P>' X$ \$ S' l, T0 o$ l+ O
  17. <P>Direction* direction1 = NULL;4 P0 B4 V7 B8 n( n8 W* C
  18. direction1 = workPart->Directions()->CreateDirection(originPoint, direction, SmartObject::UpdateOptionWithinModeling);</P>
    % Y) z1 p- R% |4 b* x( {8 A" V
  19. <P>//Set diameter and height
    1 v: H% [( B) O. u( ?- ?9 N& k& b' j3 D
  20. std::stringstream diameterValue;) W" a. H" \* Z* j
  21. diameterValue << diameter->GetValue();
    8 h* M3 U6 f+ c4 b3 E
  22. std::stringstream heightValue;7 w) B; ^6 p/ u2 `, Z4 G
  23. heightValue << height->GetValue();</P>
    6 ^2 o' c& ^9 O/ v4 V
  24. <P>cylinderBuilder1->Diameter()->SetRightHandSide(diameterValue.str());
    9 q& |5 a# ?0 _& M
  25. cylinderBuilder1->Height()->SetRightHandSide(heightValue.str());</P>
    9 m0 N. _# C; p, u* q
  26. <P>//Set the axis; w5 t" k1 Y0 i' d
  27. Axis* axis1 = NULL;; l& N: r6 E$ O7 p. P) O
  28. axis1 = cylinderBuilder1->Axis();
    ; |5 A. {4 a3 a" z! O" K
  29. axis1->Point()->SeTCoordinates(originPoint);4 X- X/ j6 k8 w7 k9 j) y8 Y
  30. axis1->SetDirection(direction1);</P>2 A2 K6 K$ x' D) c+ {
  31. <P>//Commit( y/ }! f8 n( Y5 R2 b/ R- h
  32. cylinderBuilder1->Commit();
    " ~! S, m" O. b7 C
  33. cylinderBuilder1->Destroy();6 o5 ?; Z0 _% |: v$ D& @
  34. cylinderBuilder1 = NULL;
    3 f+ G/ Q, @- K
  35. }
    $ `0 g1 x7 s  a$ g
  36. </P>
复制代码

( n! L7 e$ l1 v( |# f
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了