|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
* g: y" v- i6 w7 |4 ?
1 P# p i4 a% x9 I4 m6 LUG NX二次开发旋转特征代码分享
/ P( u H8 B$ `) r6 j# @' C$ H7 } d: G- C
如何使用NX二次开发进行旋转2 e: l ^1 q/ V0 c y3 p- F% D4 y I3 F
3 U$ P( O; I$ ?- void lesson33_createRevolve::createRevolve(SkeTCh *sketch), m& B2 q1 y' [. F2 Q; k- f
- {
9 W. w" N' w/ `! ] - Features::Feature *nullFeatures_Feature(NULL);# D/ D: E) X. T6 k4 \/ |4 ~4 ^
* }' q, c, h! l- H/ M" J- Features::RevolveBuilder *revolveBuilder1;( [) h$ Q9 L5 U
- revolveBuilder1 = workPart->Features()->CreateRevolveBuilder(nullFeatures_Feature);
9 s; s2 L* d4 S5 V9 @ - revolveBuilder1->SetTolerance(0.001);6 X8 b. P" E+ P6 @ L2 t
- Section *section1;$ s# M3 d& c" j1 y) `8 N5 n& g- a2 O
- section1 = workPart->Sections()->CreateSection(0.00095, 0.001, 0.05);6 I2 v& f7 P$ c- Q2 h3 w; f
- revolveBuilder1->SetSection(section1);% ^% c- d+ z2 {+ c0 m6 ?
- std::vector<Features::Feature *> features1(1);
4 i/ P! L$ K4 `$ A' O6 \ b" {$ l - features1[0] = sketch->Feature();1 [1 t& W+ j# D. D/ R
- CurveFeatureRule *curveFeatureRule1;
4 ?$ E( \0 v) j5 q" Q - curveFeatureRule1 = workPart->ScRuleFactory()->CreateRuleCurveFeature(features1);
7 [; F: s9 k( P0 Q7 {7 @ - std::vector<SelectionIntentRule *> rules1(1);; J/ d+ _, E# P7 y; d& f$ ?( ]
- rules1[0] = curveFeatureRule1;( ?' r8 r8 f% p
- NXObject *nullNXObject(NULL);
+ R6 W8 {* \- V; t% u3 \ - Point3d helpPoint1(0, 0, 0);
" t. }' s! X( O1 l, Y - section1->AddToSection(rules1, nullNXObject, nullNXObject, nullNXObject, helpPoint1, Section::ModeCreate, false);
7 ?$ O; y+ j: w+ p9 {1 u4 R - revolveBuilder1->SetSection(section1);
# \' N$ w; Q+ ^/ A7 J/ ^ - // get UI value4 a R. D% {- `' e o
- vector<TaggedObject*> selectedObjects = this->axis0->GetProperties()->GetTaggedObjectVector("SelectedObjects");
4 Q6 K! C0 Z7 |; m3 l- ~ - Axis *axis1 = dynamic_cast<Axis *>(selectedObjects[0]);2 R" b E' b8 [% G' @
- revolveBuilder1->SetAxis(axis1);7 y% F$ Y0 N; p, _1 M2 w2 F
- double startValue = this->expStartAngle->GetProperties()->GetDouble("Value");
5 [$ W B7 m' D - double endValue = this->expStartAngle1->GetProperties()->GetDouble("Value");
# p0 G& L0 p/ C& n - stringstream s_startValue,s_endValue;
" z# l3 P% P' ]/ K% H8 R& J3 ^ - s_startValue <<startValue;" k$ z/ b( z5 ^& H+ o0 y" x, S
- s_endValue <<endValue;
0 ]; c. n6 C: b7 p) w( x* D) M - revolveBuilder1->Limits()->StartExtend()->Value()->SetRightHandSide(s_startValue.str());# o8 S1 d$ N3 o5 i% n3 h# N
- revolveBuilder1->Limits()->EndExtend()->Value()->SetRightHandSide(s_endValue.str());
/ R; b+ T& j8 n P+ U - Features::Feature *feature1;4 b: {( U) z) v9 y; O
- feature1 = revolveBuilder1->CommitFeature();
4 O2 p9 o, B* Z4 m - revolveBuilder1->Destroy();
0 i1 y2 ^: s `6 F5 N - section1->Destroy();
; H) P# @- D3 e# k - }
复制代码
2 d# b" {& B. s+ R$ u
" ]# u" M: Y9 A! _* n6 I$ }& c/ V
1 I* b: u3 u5 w7 Y G# U; e |
|