|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
f; G/ O" a7 k* l
# \7 O$ Q# k( J2 ^. oUG NX二次开发旋转特征代码分享
6 U0 @% ^. [7 Q$ ~7 p3 G" V" V9 f7 y3 {
如何使用NX二次开发进行旋转, a7 L/ T: L% a- J a: L
+ K# `# `+ [/ m" ~7 w, \- void lesson33_createRevolve::createRevolve(SkeTCh *sketch)
0 p3 `3 Y, [ l K0 t( i2 m5 n - {
' ~* r1 u ^! r - Features::Feature *nullFeatures_Feature(NULL);# x+ f. n7 Y; Z' O
3 E$ _. Q' Q5 h8 M) O- Features::RevolveBuilder *revolveBuilder1;
- ?1 X6 d& v& K0 @: p& F - revolveBuilder1 = workPart->Features()->CreateRevolveBuilder(nullFeatures_Feature);
; f2 F4 d. [ a: U - revolveBuilder1->SetTolerance(0.001);
9 ?1 B. B; _+ t/ Y9 p$ o) W, L - Section *section1;2 Y8 A0 o" |& W9 r5 Y$ L q' S
- section1 = workPart->Sections()->CreateSection(0.00095, 0.001, 0.05);
8 |" a$ n7 J6 d6 {0 L* b9 E - revolveBuilder1->SetSection(section1);. r0 W: L# W) y8 c' R7 h' ?2 H
- std::vector<Features::Feature *> features1(1);" h% Z. L. `+ j5 x7 M
- features1[0] = sketch->Feature();
& u& h$ I1 t2 a$ [ - CurveFeatureRule *curveFeatureRule1;, W! w& s. H+ d: q% a& O
- curveFeatureRule1 = workPart->ScRuleFactory()->CreateRuleCurveFeature(features1);2 \; N$ u9 L) s" O# Y6 V* N% W
- std::vector<SelectionIntentRule *> rules1(1);8 g% m6 \, N( h/ t* u
- rules1[0] = curveFeatureRule1;
) d; K& r- ?- }0 \' N. s - NXObject *nullNXObject(NULL);8 l8 P2 w4 b r P
- Point3d helpPoint1(0, 0, 0);% }! N9 P/ q _
- section1->AddToSection(rules1, nullNXObject, nullNXObject, nullNXObject, helpPoint1, Section::ModeCreate, false);
2 n6 e% _: P% r - revolveBuilder1->SetSection(section1);3 f2 ?, D3 d4 d
- // get UI value
9 \4 L" K% A, Z% U: K - vector<TaggedObject*> selectedObjects = this->axis0->GetProperties()->GetTaggedObjectVector("SelectedObjects");
8 t8 q, x. t, b z6 _& } - Axis *axis1 = dynamic_cast<Axis *>(selectedObjects[0]);- p( [4 n& D0 O0 o/ N; q. \
- revolveBuilder1->SetAxis(axis1);# N# b; ?7 E5 C7 z5 p ~( W5 q" l
- double startValue = this->expStartAngle->GetProperties()->GetDouble("Value");
" I7 R! j5 w5 j- ^+ W - double endValue = this->expStartAngle1->GetProperties()->GetDouble("Value");
) ~0 T" Y8 z( \ - stringstream s_startValue,s_endValue;
( x; j, U( d5 I& l9 z) c. H' m - s_startValue <<startValue; `! u# \% Z0 D
- s_endValue <<endValue;- U: }! K t) M
- revolveBuilder1->Limits()->StartExtend()->Value()->SetRightHandSide(s_startValue.str());' y: X% \ J( w) O1 p7 N
- revolveBuilder1->Limits()->EndExtend()->Value()->SetRightHandSide(s_endValue.str());. f- S) U9 L7 L
- Features::Feature *feature1;* |/ N- o% L0 N B8 v+ M
- feature1 = revolveBuilder1->CommitFeature();
% W; ^3 N. D1 K6 K' E3 p R* E - revolveBuilder1->Destroy();
( A+ F; H l" }: A - section1->Destroy();! O9 A# ~/ p: C
- }
复制代码 - R7 f2 w- u8 \% E k. x+ L
+ o5 q% l# {9 g! s/ [2 _- d
4 O! V' n' \: \, f
|
|