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

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

[复制链接]

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

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

admin 楼主

2014-4-13 11:27:48

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

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

x
6 t$ K! j' f; W- J

2 v- m9 I0 t1 s- {% {UG NX二次开发旋转特征代码分享
$ d" o: I7 Q4 c% R, W- g
- U) x1 _- o( c  Z$ o/ q如何使用NX二次开发进行旋转
  e8 I; F4 ~2 V6 r) v0 V+ Z0 z* \
  1. void lesson33_createRevolve::createRevolve(SkeTCh *sketch)
    6 j" ~% A# t/ F6 g% Q
  2. {0 N' F* N/ V7 v1 I3 `
  3.          Features::Feature *nullFeatures_Feature(NULL);, C1 h) B6 X& K# W" ~0 ~

  4. ( N. P: J. z& I8 c) }* l$ ]! t, Z
  5.     Features::RevolveBuilder *revolveBuilder1;# E- A* j* O. z8 N! `: ~$ Q
  6.     revolveBuilder1 = workPart->Features()->CreateRevolveBuilder(nullFeatures_Feature);4 \/ e4 o: k6 u4 d: k. \, n% C
  7.         revolveBuilder1->SetTolerance(0.001);4 F' J0 G- a# n8 {; {
  8.     Section *section1;# ]" e# o! _) b2 B0 k- i
  9.     section1 = workPart->Sections()->CreateSection(0.00095, 0.001, 0.05);
    " x! U* l) k/ c
  10.     revolveBuilder1->SetSection(section1);, d4 z' i) l, t$ S, v
  11.     std::vector<Features::Feature *> features1(1);
    " U# F1 G4 [+ {) {, h/ k
  12.         features1[0] = sketch->Feature();( |2 Z9 N# }7 g( r6 ]$ i# M9 W
  13.     CurveFeatureRule *curveFeatureRule1;
    / `% Q4 j$ x4 k+ x% b) V( |
  14.     curveFeatureRule1 = workPart->ScRuleFactory()->CreateRuleCurveFeature(features1);
    9 T3 P" d2 m. |: p0 i5 I  n, G
  15.     std::vector<SelectionIntentRule *> rules1(1);: w6 a' O/ m" W
  16.     rules1[0] = curveFeatureRule1;5 f5 P0 {" e% {* _' g4 H
  17.     NXObject *nullNXObject(NULL);3 j  O" ~8 O# m$ f1 x" P
  18.     Point3d helpPoint1(0, 0, 0);
      d1 E7 o$ y' b1 l  ^* O
  19.     section1->AddToSection(rules1, nullNXObject, nullNXObject, nullNXObject, helpPoint1, Section::ModeCreate, false);
    $ ?6 P+ w, N# n! @2 c4 _1 u: L) s
  20.     revolveBuilder1->SetSection(section1);
    / s0 D& ]: d5 {  H
  21.         // get UI value
    # M8 l8 d# `8 j6 L% L/ K
  22.         vector<TaggedObject*> selectedObjects = this->axis0->GetProperties()->GetTaggedObjectVector("SelectedObjects");
    / F3 {" c8 B2 Q+ t
  23.         Axis *axis1 = dynamic_cast<Axis *>(selectedObjects[0]);
    3 t  h& D* V4 l' y% r
  24.         revolveBuilder1->SetAxis(axis1);7 D) J/ _5 Z9 M7 i2 i( Z& A
  25.         double startValue = this->expStartAngle->GetProperties()->GetDouble("Value");6 v+ }2 V* {) C
  26.         double endValue = this->expStartAngle1->GetProperties()->GetDouble("Value");4 t0 Q4 a+ Z) C5 v  Y# _
  27.          stringstream s_startValue,s_endValue;# L' j( A" g, ~. ~$ ]' s" g
  28.          s_startValue <<startValue;( S5 ~; W8 G' |! a8 W- R
  29.          s_endValue <<endValue;
    & Q3 J/ ~- ?7 Z3 W- f5 |5 G
  30.          revolveBuilder1->Limits()->StartExtend()->Value()->SetRightHandSide(s_startValue.str());- C0 M5 x: P( s2 ^1 l( x& S
  31.          revolveBuilder1->Limits()->EndExtend()->Value()->SetRightHandSide(s_endValue.str());
    % g5 e! ^# d, C' c( [" p! {
  32.     Features::Feature *feature1;; z  |# U* c; h5 K: F7 {' f
  33.     feature1 = revolveBuilder1->CommitFeature();
    6 D8 E. H" A! A4 k; S) Q$ v) ^
  34.         revolveBuilder1->Destroy();
    7 R4 @5 ], ]3 p# F6 o, E
  35.         section1->Destroy();! g& f& P& g* z) k- |9 u
  36. }
复制代码

$ k  }) B9 e! H5 k, O; y, V2 T$ J" }5 ~  ?8 I! X) E  I
3 W1 O* o9 i+ ]
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了