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

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

[复制链接]

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

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

admin 楼主

2013-11-4 12:06:33

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

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

x
NX二次开发源码分享:NXOpen C++创建圆柱体特征& j& z# A, q2 M% m- p* o6 ?: _; c
  1. ) n9 I4 O# n+ I: X/ P6 X
  2. <P> </P>
复制代码
  1. - F; w6 m3 }5 g# }$ g
  2. <P>void CreateCylinder_UsingUDB::CreateCylinder()2 W$ [0 A4 ^) d
  3. {0 e& i- `9 Z* O% {/ Y
  4. Part* workPart(theSession->Parts()->Work());</P>
    4 ]( o1 [& ]6 q! j" `+ B
  5. <P>Features::CylinderBuilder* cylinderBuilder1 = NULL;* y( g. q  `$ x$ P8 S
  6. cylinderBuilder1 = workPart->Features()->CreateCylinderBuilder(NULL);</P>% g, l0 J5 K+ R6 X1 e( d
  7. <P>//Get the point
    0 @: z( p9 y" w+ @3 ]7 G
  8. PropertyList* pointPropertyList = point0->GetProperties();
    , M1 N0 [+ g; C; L3 k8 u
  9. Point3d originPoint = pointPropertyList->GetPoint("Point");
    & O3 T) w+ y: m: G
  10. delete pointPropertyList;* D+ {, G3 \( m
  11. pointPropertyList = NULL;</P>
    5 U! G/ M: k/ k. q
  12. <P>//Get the direction
    8 i+ `$ N$ [4 y
  13. PropertyList* vectorPropertyList = vector0->GetProperties();
    4 h8 a2 A6 Z( R5 ]
  14. Vector3d direction = vectorPropertyList->GetVector("Vector");- x7 |0 b8 G& b3 E% p
  15. delete vectorPropertyList;
    / T. a5 g6 ?* g" S$ j
  16. vectorPropertyList = NULL;</P>& q5 @. ]' I: C1 p% |1 ?
  17. <P>Direction* direction1 = NULL;/ N, U+ Q1 y0 ?1 b# b- ]
  18. direction1 = workPart->Directions()->CreateDirection(originPoint, direction, SmartObject::UpdateOptionWithinModeling);</P>
    % g1 z) z% Y& _2 h
  19. <P>//Set diameter and height
    , _, W" v# Z- N$ V" o9 w( [% n, q
  20. std::stringstream diameterValue;
    8 B5 G- s# a* v) l+ k+ X1 Q1 [
  21. diameterValue << diameter->GetValue();
    % l: r* H9 X/ F; N' g
  22. std::stringstream heightValue;
    " q7 t) X8 H4 M( P
  23. heightValue << height->GetValue();</P>
    & X* T7 |6 m3 d3 v4 _# ^: h3 E
  24. <P>cylinderBuilder1->Diameter()->SetRightHandSide(diameterValue.str());
    2 m6 b8 y  H3 y$ m& e  J
  25. cylinderBuilder1->Height()->SetRightHandSide(heightValue.str());</P>
    5 n; g+ L0 }8 \0 z8 G% P
  26. <P>//Set the axis. I- F9 H( r! G
  27. Axis* axis1 = NULL;
    & z( P! ?4 A' u
  28. axis1 = cylinderBuilder1->Axis();7 \/ i9 r9 I, {
  29. axis1->Point()->SeTCoordinates(originPoint);
    8 U6 v: K' ?  \. \5 d6 [
  30. axis1->SetDirection(direction1);</P>& E: A  Y$ j, i
  31. <P>//Commit( {5 w- Q, a6 G, f/ a* K6 f+ e' W
  32. cylinderBuilder1->Commit();" ^6 H! a/ j. z0 Y0 v! x
  33. cylinderBuilder1->Destroy();
    . m, X, [7 o: d* Q/ Z
  34. cylinderBuilder1 = NULL;
    # ^& E0 p! _5 t7 |) i
  35. }( g) ?+ Q$ t3 g; j* P1 x6 A7 \4 t+ Y
  36. </P>
复制代码
" Z1 r, O# T2 C7 k8 c
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了