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

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

[复制链接]

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

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

admin 楼主

2014-4-13 11:27:48

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

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

x

( T( U$ U9 E5 J! h4 n8 L( Q+ ~
UG NX二次开发旋转特征代码分享$ e& m$ T" f7 q* Z3 s

) h% d9 f+ I9 f9 A# G如何使用NX二次开发进行旋转# D. v6 a6 H, G

$ F6 i' R4 [1 R) r# A8 K" o/ {. N
  1. void lesson33_createRevolve::createRevolve(SkeTCh *sketch)' |; B: [, t) @' {, p9 z
  2. {
    # K0 v# x; }1 G5 R5 Q
  3.          Features::Feature *nullFeatures_Feature(NULL);* q3 _( E& ~1 }: R2 D

  4. % A4 o! Y7 l, A  Z! y# M' h" G( s
  5.     Features::RevolveBuilder *revolveBuilder1;7 B/ T4 b! n  p8 W' v% }$ X
  6.     revolveBuilder1 = workPart->Features()->CreateRevolveBuilder(nullFeatures_Feature);
    % }' c" L: N9 U5 G1 F/ ?& S
  7.         revolveBuilder1->SetTolerance(0.001);/ P5 j7 `& M3 L! f6 g( E
  8.     Section *section1;
    ' J* a  R' w9 f, ?: d' B
  9.     section1 = workPart->Sections()->CreateSection(0.00095, 0.001, 0.05);6 i$ w, {; l5 g. @2 d
  10.     revolveBuilder1->SetSection(section1);) S/ K0 z) M' c7 g6 [& w
  11.     std::vector<Features::Feature *> features1(1);
    6 a  x6 y5 |+ [
  12.         features1[0] = sketch->Feature();
    # a3 T8 f3 O) P( E6 ^- ~- H
  13.     CurveFeatureRule *curveFeatureRule1;* Z) q$ `2 Q2 z' [) u3 D/ ]$ r
  14.     curveFeatureRule1 = workPart->ScRuleFactory()->CreateRuleCurveFeature(features1);" W) c( V3 m) l7 y; ^3 W7 F9 o& ?
  15.     std::vector<SelectionIntentRule *> rules1(1);: C- ?# z9 e- P# F1 R; _
  16.     rules1[0] = curveFeatureRule1;3 g0 W1 E% u" Z" e! f) z
  17.     NXObject *nullNXObject(NULL);
    . g0 l# A; b, J% n8 n4 e7 c: V" `
  18.     Point3d helpPoint1(0, 0, 0);
    5 D" C* a' t  E7 s
  19.     section1->AddToSection(rules1, nullNXObject, nullNXObject, nullNXObject, helpPoint1, Section::ModeCreate, false);$ \; C$ d  X1 J3 d
  20.     revolveBuilder1->SetSection(section1);
    % _. W/ p( [0 h/ Z: C
  21.         // get UI value
    ) _1 T6 ]- t  a
  22.         vector<TaggedObject*> selectedObjects = this->axis0->GetProperties()->GetTaggedObjectVector("SelectedObjects");+ T! A: p0 U0 W) o  ]/ C9 [
  23.         Axis *axis1 = dynamic_cast<Axis *>(selectedObjects[0]);$ t! y# Y$ T# e0 m# K
  24.         revolveBuilder1->SetAxis(axis1);. ^0 [) }9 N) Q4 K- E0 u, ?
  25.         double startValue = this->expStartAngle->GetProperties()->GetDouble("Value");& T, j7 M) r  J' m
  26.         double endValue = this->expStartAngle1->GetProperties()->GetDouble("Value");
    ' @8 [& P, y" `$ R! r
  27.          stringstream s_startValue,s_endValue;; b: ^. f. _7 D7 o3 n$ ]: z
  28.          s_startValue <<startValue;7 g4 i8 g5 v! b: E  l0 V( y
  29.          s_endValue <<endValue;
    * J! ^3 o1 m2 T" a
  30.          revolveBuilder1->Limits()->StartExtend()->Value()->SetRightHandSide(s_startValue.str());
    # t* J+ S+ U1 A; |/ `2 b4 X" X, u
  31.          revolveBuilder1->Limits()->EndExtend()->Value()->SetRightHandSide(s_endValue.str());
    / A, y! z6 }: }9 b) l/ e
  32.     Features::Feature *feature1;5 F5 m* z* `4 b$ o6 V
  33.     feature1 = revolveBuilder1->CommitFeature();( X1 z6 {) o. w' `9 |  o
  34.         revolveBuilder1->Destroy();
    ' B1 w0 P9 N8 U% T3 ^/ I0 f% i
  35.         section1->Destroy();
    + V6 R* [* E  V
  36. }
复制代码

) V) U: g' P4 a$ X5 g! z7 ]7 Q+ `! _
3 q/ q9 T3 n4 G5 p
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.diantuankj.com/ doTeam.tech
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 注册

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

    本网站(plmhome.com)为PLM之家工业软件学习官网站

    展示的视频材料全部免费,需要高清和特殊技术支持请联系 QQ: 939801026

    PLM之家NX CAM二次开发专题模块培训报名开始啦

    我知道了