|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
6 z' Y7 O1 J, G; R9 D* v" @9 p
]' t5 P2 f6 m" lUG NX二次开发旋转特征代码分享2 C/ K1 b0 F. f% _6 ~8 [2 M' Z
8 i* {9 j) [) V
如何使用NX二次开发进行旋转8 Z' ]. D7 }* W7 a3 f# C8 E
; F! M. M$ H% m2 }- f' g- void lesson33_createRevolve::createRevolve(SkeTCh *sketch)- @2 R! Q# E$ n
- {
# A! a& s1 `. d! i; V _ - Features::Feature *nullFeatures_Feature(NULL);9 I& d% t6 H7 R G$ T
- 9 C s4 A+ P+ i) J" s
- Features::RevolveBuilder *revolveBuilder1;7 h5 A! p: [' E$ f
- revolveBuilder1 = workPart->Features()->CreateRevolveBuilder(nullFeatures_Feature);' w" E! n" [" Q
- revolveBuilder1->SetTolerance(0.001);
" o0 X5 H" f+ i$ a" v - Section *section1;5 [5 o0 ]+ u/ G9 Z* f2 t F
- section1 = workPart->Sections()->CreateSection(0.00095, 0.001, 0.05);6 _" E# V/ N0 g* ]9 D
- revolveBuilder1->SetSection(section1);& K) x( F- y# z3 O
- std::vector<Features::Feature *> features1(1);) v9 W/ C9 R- b2 z, w
- features1[0] = sketch->Feature();
4 j; C9 K" [, n% L$ V5 L1 K - CurveFeatureRule *curveFeatureRule1;9 L- J& F/ S0 N, K1 ^# I
- curveFeatureRule1 = workPart->ScRuleFactory()->CreateRuleCurveFeature(features1);
3 f; ` h/ e M2 c: F$ b: M - std::vector<SelectionIntentRule *> rules1(1);/ A- e+ Y" \, A9 ^% G3 B
- rules1[0] = curveFeatureRule1;; b' @2 c6 F" v& ^+ y' ~ a! r
- NXObject *nullNXObject(NULL);
! y. F5 ~& B, C' a8 _6 E - Point3d helpPoint1(0, 0, 0);3 y V$ p# L" q* [6 C% I
- section1->AddToSection(rules1, nullNXObject, nullNXObject, nullNXObject, helpPoint1, Section::ModeCreate, false);' a2 J1 v) C) z. z9 [4 I" c
- revolveBuilder1->SetSection(section1);
3 j$ S7 {* |( L3 q- B - // get UI value* q- _/ U$ ?6 P; R {5 A' U" I
- vector<TaggedObject*> selectedObjects = this->axis0->GetProperties()->GetTaggedObjectVector("SelectedObjects");
/ n7 [( F+ i6 J4 M& D - Axis *axis1 = dynamic_cast<Axis *>(selectedObjects[0]);
* O' y" I4 k7 k - revolveBuilder1->SetAxis(axis1);% D3 { ^- j4 d" J
- double startValue = this->expStartAngle->GetProperties()->GetDouble("Value");2 l4 Q# l$ r: X! L, y# ]
- double endValue = this->expStartAngle1->GetProperties()->GetDouble("Value");
( L- c8 B' J* e - stringstream s_startValue,s_endValue;0 o3 d& N9 X- z0 a
- s_startValue <<startValue;
- N, [% m7 p1 A( b X8 g8 \ - s_endValue <<endValue;
5 Y; A2 b. g3 w - revolveBuilder1->Limits()->StartExtend()->Value()->SetRightHandSide(s_startValue.str());6 P3 n1 l6 Y5 n \
- revolveBuilder1->Limits()->EndExtend()->Value()->SetRightHandSide(s_endValue.str());
% R! j; C* X: e; N# h6 M4 y - Features::Feature *feature1;
; y7 O; h5 P( a5 S1 z4 a2 L# p - feature1 = revolveBuilder1->CommitFeature();" M: G7 K- Y2 h+ I, u" m( f2 y
- revolveBuilder1->Destroy();
1 {# l! m* k( j3 @2 _( O+ S - section1->Destroy();
8 T5 m! n) ]; M, X7 F# t0 Z - }
复制代码 2 m. m8 W s( `, y5 J: E: ~/ z) \
3 [8 ]5 J" {: V; U
- S6 e6 ^+ m: V2 u) F* ]& V
|
|