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

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

[复制链接]

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

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

admin 楼主

2013-11-4 12:06:33

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

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

x
NX二次开发源码分享:NXOpen C++创建圆柱体特征/ Q" u& ^- G. T! X2 w! p* }) J: @
  1. 9 n3 {3 R9 S1 N8 \, P, ?
  2. <P> </P>
复制代码

  1. 0 Q% b! I; L+ W6 O( u& b0 a; a' h: s1 X
  2. <P>void CreateCylinder_UsingUDB::CreateCylinder(); V( O) M/ u$ I8 G6 t2 Z: M
  3. {& Y6 K/ A5 a( k: n2 L! B
  4. Part* workPart(theSession->Parts()->Work());</P>* C% v- g, j" \- B- F" g
  5. <P>Features::CylinderBuilder* cylinderBuilder1 = NULL;
    / }! N# b6 h' {" G; ?* @
  6. cylinderBuilder1 = workPart->Features()->CreateCylinderBuilder(NULL);</P>
    9 V2 b, K/ ]% L6 |
  7. <P>//Get the point7 e3 J: b" A2 \' I
  8. PropertyList* pointPropertyList = point0->GetProperties();
    6 `5 X" w, j* V4 F2 }- F# L8 j
  9. Point3d originPoint = pointPropertyList->GetPoint("Point");
    " j7 U6 H0 k2 i2 K2 B
  10. delete pointPropertyList;1 x! A3 c+ j3 y
  11. pointPropertyList = NULL;</P>
    ( v( o3 I  n& M8 y: b5 Z  n
  12. <P>//Get the direction; k7 F( v& n6 _- S7 V
  13. PropertyList* vectorPropertyList = vector0->GetProperties();, i/ a" M' ~& u- V. K
  14. Vector3d direction = vectorPropertyList->GetVector("Vector");
    % K/ a3 }. R" \; M% Q
  15. delete vectorPropertyList;
    0 u% B7 s( r2 K8 Y, m! ?
  16. vectorPropertyList = NULL;</P>
    & V/ h/ U& ]* |& n7 S& a6 l3 a$ S
  17. <P>Direction* direction1 = NULL;
    1 A% s3 f1 q5 E$ y" b
  18. direction1 = workPart->Directions()->CreateDirection(originPoint, direction, SmartObject::UpdateOptionWithinModeling);</P>9 |$ T5 G  r; X; ~$ W4 |
  19. <P>//Set diameter and height( r! M( X" O& K7 Q  [& |
  20. std::stringstream diameterValue;
    0 u5 n4 a  G* E& M
  21. diameterValue << diameter->GetValue();! e: {& N- ~! d% G. o/ n) N; Q
  22. std::stringstream heightValue;
    ( E# L, d- _/ R( y8 D, ]* V
  23. heightValue << height->GetValue();</P>
    1 n1 _5 n5 s1 s& X0 u* |* i
  24. <P>cylinderBuilder1->Diameter()->SetRightHandSide(diameterValue.str());
    - d- g1 q( h! c, X( K
  25. cylinderBuilder1->Height()->SetRightHandSide(heightValue.str());</P>/ \& p, l. U; B/ ]4 ^
  26. <P>//Set the axis
    1 ~4 S% Y9 @/ ], |, E+ j* ^( C# Z
  27. Axis* axis1 = NULL;& y. @; C$ U) I) `
  28. axis1 = cylinderBuilder1->Axis();' U: q, n. j# T2 g3 n. D. e
  29. axis1->Point()->SeTCoordinates(originPoint);5 S0 K9 h# c" \5 G0 x6 G- p
  30. axis1->SetDirection(direction1);</P>
    8 c# v6 b& S0 z+ s
  31. <P>//Commit9 Z6 Z" T% ?6 Y! m
  32. cylinderBuilder1->Commit();
    / p& \. G  e$ Z5 o2 T9 N! Y7 g% l
  33. cylinderBuilder1->Destroy();2 `1 }* t+ h; B' p+ }/ W) G
  34. cylinderBuilder1 = NULL;
    5 }0 V3 e4 a6 b8 I0 A4 v; S
  35. }2 X' m* V+ p, W# S7 B
  36. </P>
复制代码
/ S+ M; w# P6 f! a* ~1 G
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了