|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
u: n* a, o% c
Y* f5 p4 D0 \9 @8 o7 R
UG NX二次开发旋转特征代码分享
4 \2 {/ {6 [& z' q6 |8 k [# H7 [. C: ^! `
如何使用NX二次开发进行旋转
) \+ Z6 I2 M$ K7 K8 V* i" t: ^
0 z) x3 f/ l) V% J4 h8 l- void lesson33_createRevolve::createRevolve(SkeTCh *sketch)
: Q5 d$ O4 T }/ d - {$ G4 x5 x+ Y7 L/ ^( c& b, d, ]5 A
- Features::Feature *nullFeatures_Feature(NULL);
: ^) H- y! b8 n5 j3 _& O
! R- P8 ]1 Z& K9 h/ O6 n! y- Features::RevolveBuilder *revolveBuilder1;
2 h2 ?! j* [& \; T( e2 m - revolveBuilder1 = workPart->Features()->CreateRevolveBuilder(nullFeatures_Feature);
/ S, [3 ] C* Y! K) x0 ^$ B* i - revolveBuilder1->SetTolerance(0.001);
. ^7 \% h" E# p* B5 ~! Q - Section *section1;
* c1 q7 K% V& p+ [% G - section1 = workPart->Sections()->CreateSection(0.00095, 0.001, 0.05);' u1 s/ ]% S" Y
- revolveBuilder1->SetSection(section1);
4 U" U& v" r; C2 k/ m3 v - std::vector<Features::Feature *> features1(1);3 i/ t6 F: Q: W4 Q2 r! @' d
- features1[0] = sketch->Feature();
* y/ t5 p2 j& L/ E7 b - CurveFeatureRule *curveFeatureRule1;* y( o; @4 v+ Y* H) m0 X9 h$ C' t" ?
- curveFeatureRule1 = workPart->ScRuleFactory()->CreateRuleCurveFeature(features1);
3 C$ `0 v4 W/ ~( g9 q& u3 l - std::vector<SelectionIntentRule *> rules1(1);
7 u; }# s- \+ B! u3 n9 H1 J# c - rules1[0] = curveFeatureRule1;& K# k& @! M: V/ w3 m) D0 u" D* i
- NXObject *nullNXObject(NULL);2 l: c. u6 L# O J
- Point3d helpPoint1(0, 0, 0);. E, _- f% t/ C8 M+ _: W- }2 A
- section1->AddToSection(rules1, nullNXObject, nullNXObject, nullNXObject, helpPoint1, Section::ModeCreate, false);
* S: r4 P6 Y k4 U$ f9 e - revolveBuilder1->SetSection(section1);5 c: E0 E2 ?0 G |
- // get UI value
6 a. h, G& o# I - vector<TaggedObject*> selectedObjects = this->axis0->GetProperties()->GetTaggedObjectVector("SelectedObjects");: y4 n+ Q6 m, ]" {; `5 F
- Axis *axis1 = dynamic_cast<Axis *>(selectedObjects[0]);4 {9 q/ K# b: `
- revolveBuilder1->SetAxis(axis1);
* U' A; W9 A5 {% M7 z" G, l/ X9 @ - double startValue = this->expStartAngle->GetProperties()->GetDouble("Value");
; N! R7 I5 `0 M3 _ - double endValue = this->expStartAngle1->GetProperties()->GetDouble("Value");6 L1 j' F0 @ `! F& f4 Z
- stringstream s_startValue,s_endValue;( `9 ~7 u! W- S+ M( a, B0 X w: R8 a
- s_startValue <<startValue;6 s K3 e+ ]/ o) ]
- s_endValue <<endValue;$ j2 i0 y$ q3 Z" ], p4 ^' o' {, l
- revolveBuilder1->Limits()->StartExtend()->Value()->SetRightHandSide(s_startValue.str());
; i7 p+ S4 M3 w - revolveBuilder1->Limits()->EndExtend()->Value()->SetRightHandSide(s_endValue.str());7 c6 }( `/ ], L. w, ?
- Features::Feature *feature1;
" D3 Z$ ^6 F, G' b& E3 B" Y - feature1 = revolveBuilder1->CommitFeature();/ @! b. ^* W# N9 [9 w# z' b
- revolveBuilder1->Destroy();7 ^- F7 s: |: g2 i1 t1 V& m/ Y
- section1->Destroy();9 Z5 h7 L4 i0 N# A0 S' ]
- }
复制代码
! t ]7 x5 W8 Y3 E& L8 v' p" j8 t5 t1 _, A- `: i( J
0 }. R! P3 t4 I3 }' a4 p
|
|