|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
) }- c8 O$ W0 r7 [1 p# b8 z h/ H' i% P" l- c2 H
UG NX二次开发旋转特征代码分享
# k4 p/ `/ S- ~4 [% h! e( i
; R, U+ R# W% g" `7 D* b如何使用NX二次开发进行旋转
4 x% s" f. w; ^6 F! S/ r+ K( ]" c/ t5 H2 d, H
- void lesson33_createRevolve::createRevolve(SkeTCh *sketch)/ n+ I5 c1 ^$ J, H$ B$ Z* D E
- {1 w! H' a2 Y9 t3 I5 v$ i7 ~8 m
- Features::Feature *nullFeatures_Feature(NULL);
, A" i. D" E. |7 y* r* ?
6 |# y [7 u, z- Features::RevolveBuilder *revolveBuilder1;
% f5 o2 \+ w, k+ l0 U - revolveBuilder1 = workPart->Features()->CreateRevolveBuilder(nullFeatures_Feature);
: D+ z* n! l- u @; l - revolveBuilder1->SetTolerance(0.001);
0 G8 e% Y: r6 E/ ]" P - Section *section1;1 }5 f1 `' n7 v+ Y- s
- section1 = workPart->Sections()->CreateSection(0.00095, 0.001, 0.05);* G1 j$ K4 l: U+ B' R; i
- revolveBuilder1->SetSection(section1);
- s8 N$ h6 B# n7 z% h. f- b" n4 c4 r - std::vector<Features::Feature *> features1(1);
5 t* l$ w# B% H& @ - features1[0] = sketch->Feature();- V7 e( J/ t# T- L/ A* v7 c
- CurveFeatureRule *curveFeatureRule1;, _$ Z4 `% |- u, O4 C) S5 ^: C
- curveFeatureRule1 = workPart->ScRuleFactory()->CreateRuleCurveFeature(features1);) r" M' D4 X1 l# P1 a, B( n9 ?! d. H
- std::vector<SelectionIntentRule *> rules1(1);3 `) G4 w8 d' A* \
- rules1[0] = curveFeatureRule1;
% D1 K9 m% S1 a* S1 p. w - NXObject *nullNXObject(NULL);
& a7 m1 E0 a% @ - Point3d helpPoint1(0, 0, 0);9 H" [' Y1 F9 q7 w0 F8 K
- section1->AddToSection(rules1, nullNXObject, nullNXObject, nullNXObject, helpPoint1, Section::ModeCreate, false);
5 Q1 W( ?. m3 n3 i; y1 j - revolveBuilder1->SetSection(section1);
$ b* ?) [3 B, L' o l, u1 C M - // get UI value
- I. N3 Q4 L( e5 C3 c - vector<TaggedObject*> selectedObjects = this->axis0->GetProperties()->GetTaggedObjectVector("SelectedObjects");7 d. A9 |* r: G5 T2 g2 w5 r$ G N0 p
- Axis *axis1 = dynamic_cast<Axis *>(selectedObjects[0]);
$ d5 i% Q+ @+ e9 M- P - revolveBuilder1->SetAxis(axis1);
2 M( H( B' p( h. N3 j( A$ ~& a% Q# h - double startValue = this->expStartAngle->GetProperties()->GetDouble("Value"); W, K8 E h) x+ b
- double endValue = this->expStartAngle1->GetProperties()->GetDouble("Value");
6 d/ J) Z4 E) v" Y - stringstream s_startValue,s_endValue;' D& ?5 g1 z$ k
- s_startValue <<startValue;
9 z/ a' b+ u1 V K5 [ - s_endValue <<endValue;
, ~. Q X5 e' {# _; f# Q3 Y' ? - revolveBuilder1->Limits()->StartExtend()->Value()->SetRightHandSide(s_startValue.str());& A w X$ R! J+ k5 ]3 K# f
- revolveBuilder1->Limits()->EndExtend()->Value()->SetRightHandSide(s_endValue.str());! A% x3 p7 T2 w1 b% u
- Features::Feature *feature1;
$ v( J5 _2 }" w. M9 Z# r& G% j - feature1 = revolveBuilder1->CommitFeature();$ a& z; S2 _; v! c+ l9 [; _
- revolveBuilder1->Destroy();
" _5 A7 B% f3 p% l - section1->Destroy();' Y- x4 k' Q6 o, U+ z- O) @, H: y
- }
复制代码
* A( u8 ?# e+ j+ U, L' j$ f' r- G2 W3 e; t% i c
6 Z( a9 [/ ]; g H9 e- O |
|