|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
% R1 V* m& d e) V$ _( J' m
2 {* `1 ^% \6 k6 [2 {UG NX二次开发旋转特征代码分享
' r3 w7 s) c9 y, v# E! z0 H6 n! f2 F: ^- `% M+ x- H, S
如何使用NX二次开发进行旋转% ?$ t; N( f8 S" w2 s# z4 ?! [
$ b6 n4 J' S l( H$ h( [( |* c
- void lesson33_createRevolve::createRevolve(SkeTCh *sketch)/ m6 S. _& O/ R
- {
9 l e2 I& l3 [" c - Features::Feature *nullFeatures_Feature(NULL);
# W- Q5 W9 [0 l2 W
0 q. J+ {* R6 w- X- Features::RevolveBuilder *revolveBuilder1;
4 }" O6 Y9 t$ r% |! q - revolveBuilder1 = workPart->Features()->CreateRevolveBuilder(nullFeatures_Feature);
1 w1 j; P# Z1 ~ - revolveBuilder1->SetTolerance(0.001);/ E+ P4 l& f0 E' A0 ]; q
- Section *section1;
$ Y2 ~. M) v P* |2 Z0 a - section1 = workPart->Sections()->CreateSection(0.00095, 0.001, 0.05);
/ R+ t2 m( t& G - revolveBuilder1->SetSection(section1);
: z4 z. r# P5 M, C# A$ ], } - std::vector<Features::Feature *> features1(1);
4 R3 L5 w$ O/ j - features1[0] = sketch->Feature();0 |0 b5 u1 v% |4 l5 A
- CurveFeatureRule *curveFeatureRule1;% s4 h# Z% Z/ V/ _6 z- G
- curveFeatureRule1 = workPart->ScRuleFactory()->CreateRuleCurveFeature(features1); ^$ m8 |9 J. V- ^! t7 p+ t
- std::vector<SelectionIntentRule *> rules1(1);2 {0 T9 K/ {) y+ _4 x
- rules1[0] = curveFeatureRule1;) u4 F0 C) M. ~
- NXObject *nullNXObject(NULL);
2 U$ N) H: O! b, g - Point3d helpPoint1(0, 0, 0);
( B" v: R) u# f' x - section1->AddToSection(rules1, nullNXObject, nullNXObject, nullNXObject, helpPoint1, Section::ModeCreate, false);
) A# K: s0 W- l* K7 g. G$ ~ - revolveBuilder1->SetSection(section1);8 b& p% [0 R& Z
- // get UI value! k) H, u. J" ~: x# }
- vector<TaggedObject*> selectedObjects = this->axis0->GetProperties()->GetTaggedObjectVector("SelectedObjects");
+ t; o6 J4 u! Y$ S; [( {5 f M - Axis *axis1 = dynamic_cast<Axis *>(selectedObjects[0]);
3 k' |& r! M! [( ^; X8 r - revolveBuilder1->SetAxis(axis1);
# v7 |5 r3 h/ N/ I, p - double startValue = this->expStartAngle->GetProperties()->GetDouble("Value");, x$ a+ e$ ? D8 R% k7 g
- double endValue = this->expStartAngle1->GetProperties()->GetDouble("Value");3 o+ g) c: R+ V q+ I$ a0 b
- stringstream s_startValue,s_endValue;, ^: ^ s1 b& G L
- s_startValue <<startValue;0 @9 ~ o9 u' e6 i
- s_endValue <<endValue;
U8 B) G6 Q$ P9 x! m% ]) t8 C - revolveBuilder1->Limits()->StartExtend()->Value()->SetRightHandSide(s_startValue.str());
2 `7 e) M3 Z, v$ n9 D3 V - revolveBuilder1->Limits()->EndExtend()->Value()->SetRightHandSide(s_endValue.str());+ Q+ c' p1 ^& s0 P% w
- Features::Feature *feature1;
/ f6 p% v5 N3 j8 h - feature1 = revolveBuilder1->CommitFeature();
* G3 Z- m3 C. z - revolveBuilder1->Destroy();* ~) z# n0 e! k; M. N7 j
- section1->Destroy();
; m. [( T5 H( g4 \- o( @ - }
复制代码
K6 d. H' j5 P( G8 U$ N
* o2 F9 h% V$ J2 A! O: h% e0 m2 H+ `- e' D
|
|