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

[二次开发源码] UG NX二次开发旋转特征代码分享

[复制链接]

2014-4-13 11:27:48 3177 0

admin 发表于 2014-4-13 11:27:48 |阅读模式

admin 楼主

2014-4-13 11:27:48

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

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

x
0 N  Z7 q9 ]! D6 x

. O4 Q2 S5 E" @UG NX二次开发旋转特征代码分享
, S3 \+ r) p1 _
4 X# @* Q0 F0 X如何使用NX二次开发进行旋转/ S( L( q7 t1 S$ F; b0 c, C
* l: P( p3 |* g& ?9 n
  1. void lesson33_createRevolve::createRevolve(SkeTCh *sketch)
    # I5 V, s# n2 ], }) T
  2. {
    ( W" L/ e4 Q9 d3 g0 f8 v  d
  3.          Features::Feature *nullFeatures_Feature(NULL);( e3 z! i2 K: m4 [$ U5 y0 Q& ^! p) m

  4. 9 A& U/ m' L( m
  5.     Features::RevolveBuilder *revolveBuilder1;1 Y9 Y. t' K9 S+ R( x
  6.     revolveBuilder1 = workPart->Features()->CreateRevolveBuilder(nullFeatures_Feature);) P. m6 s9 ]/ M9 ~
  7.         revolveBuilder1->SetTolerance(0.001);" V% W, e/ ^4 V6 t
  8.     Section *section1;. l3 k$ U: k# `* e+ V
  9.     section1 = workPart->Sections()->CreateSection(0.00095, 0.001, 0.05);
    / g7 k5 q4 I7 M' X2 R$ L. L
  10.     revolveBuilder1->SetSection(section1);
    0 _# Q' G# Z* D% C3 t' m
  11.     std::vector<Features::Feature *> features1(1);$ T5 C& F$ s* G% P6 R
  12.         features1[0] = sketch->Feature();% e  I% W! M6 e3 j3 i5 ?. `
  13.     CurveFeatureRule *curveFeatureRule1;
    : |" Z4 i7 u- R0 T7 }+ @) o
  14.     curveFeatureRule1 = workPart->ScRuleFactory()->CreateRuleCurveFeature(features1);  _' t9 R. q% j9 r9 a& ~7 }+ R8 t2 y
  15.     std::vector<SelectionIntentRule *> rules1(1);
    ( u" Z! N1 P# [0 [: e8 b
  16.     rules1[0] = curveFeatureRule1;$ r/ m. p5 y1 J# b: c
  17.     NXObject *nullNXObject(NULL);. v! Q2 I; k1 u. G
  18.     Point3d helpPoint1(0, 0, 0);6 e9 U+ W6 L7 V1 f2 T( P9 b- J
  19.     section1->AddToSection(rules1, nullNXObject, nullNXObject, nullNXObject, helpPoint1, Section::ModeCreate, false);
    2 q) z1 y2 ]- V7 @1 R$ F
  20.     revolveBuilder1->SetSection(section1);
    ; w; g+ e" Q$ v- ^) `
  21.         // get UI value) L, C( I* N0 f: a& v3 f4 Y) C5 K
  22.         vector<TaggedObject*> selectedObjects = this->axis0->GetProperties()->GetTaggedObjectVector("SelectedObjects");
    % S$ p( u9 T) Y/ @+ ]
  23.         Axis *axis1 = dynamic_cast<Axis *>(selectedObjects[0]);
    # t* ~: ^& k$ c, `
  24.         revolveBuilder1->SetAxis(axis1);! u# ]. `: y7 [" w0 p, C
  25.         double startValue = this->expStartAngle->GetProperties()->GetDouble("Value");& Z+ H% U' _  y1 Q' m
  26.         double endValue = this->expStartAngle1->GetProperties()->GetDouble("Value");2 A) o& V# X9 R; ?" P7 D
  27.          stringstream s_startValue,s_endValue;
    % X9 k5 h/ q# |( x8 p
  28.          s_startValue <<startValue;
    9 a7 {5 h% O) W: q( u
  29.          s_endValue <<endValue;, i8 i2 E% L) U" ]
  30.          revolveBuilder1->Limits()->StartExtend()->Value()->SetRightHandSide(s_startValue.str());* H  l4 t. j0 R% D0 L) d
  31.          revolveBuilder1->Limits()->EndExtend()->Value()->SetRightHandSide(s_endValue.str());% m4 |3 p% F3 L# r3 v. F! E& C
  32.     Features::Feature *feature1;7 W! D0 |5 O: {2 U; T+ p
  33.     feature1 = revolveBuilder1->CommitFeature();
    + B9 b1 r; J- Z1 }7 C5 j7 ^+ k% \# ^
  34.         revolveBuilder1->Destroy();
    ; Z1 M* U! ~8 `$ _
  35.         section1->Destroy();
    % [, |& t' A+ l( ?
  36. }
复制代码

6 ]* U2 u, ^7 T: n3 J( s3 [
8 m9 }4 E5 t) @: f% _( T* `2 b- b; L) r/ v2 D" u# J$ E% h. B" J. r
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了