|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
' g( ~* D% x0 X1 _: ?
) C2 P# e6 {/ [$ R7 i2 X8 E* hUG NX二次开发旋转特征代码分享
; P* v$ {) n) B' c4 Z" {
- [, K) Z& c- Q/ \# h+ A如何使用NX二次开发进行旋转
( M- {+ J; o4 i4 W2 M
) w/ w$ o m' q+ C4 F! f8 M. ]! z- void lesson33_createRevolve::createRevolve(SkeTCh *sketch)
* [9 ~1 B4 m z; }* C0 ^ - {
& y/ [ g9 d! }) z* u1 e g - Features::Feature *nullFeatures_Feature(NULL);% _ m1 F; I( R5 m$ R5 J- |1 n
* r' O: ]- g& b3 s- Features::RevolveBuilder *revolveBuilder1;) @9 z, V/ a# R, }
- revolveBuilder1 = workPart->Features()->CreateRevolveBuilder(nullFeatures_Feature);& m- g, l' L" N$ I. F2 w- X
- revolveBuilder1->SetTolerance(0.001);
) X% P5 K7 z+ }) |$ q( m - Section *section1;
$ i8 d8 G& U7 Z - section1 = workPart->Sections()->CreateSection(0.00095, 0.001, 0.05);
, g1 [$ U8 C/ i- y8 u - revolveBuilder1->SetSection(section1);
8 _, Q5 I* `( T+ y w - std::vector<Features::Feature *> features1(1);6 U' }( f a, V' _3 ]# U
- features1[0] = sketch->Feature();
, t% B& O% @0 q - CurveFeatureRule *curveFeatureRule1;6 e! y7 x( P" H; `% w) G
- curveFeatureRule1 = workPart->ScRuleFactory()->CreateRuleCurveFeature(features1);
! ]! x7 d' ]; l3 ^6 O - std::vector<SelectionIntentRule *> rules1(1);+ |8 D a" G% u9 S
- rules1[0] = curveFeatureRule1;; X- B4 z8 Z' Y+ ~, A+ U
- NXObject *nullNXObject(NULL);$ U$ S& q9 X8 c; O- o# Q; h. ~! }
- Point3d helpPoint1(0, 0, 0);
3 a* ` {9 w) m9 {+ J/ ^( S! k - section1->AddToSection(rules1, nullNXObject, nullNXObject, nullNXObject, helpPoint1, Section::ModeCreate, false);
0 i- F) i1 P3 D2 | - revolveBuilder1->SetSection(section1);3 W$ W6 \5 I6 u5 I& p( ]2 H" R/ E
- // get UI value, r; g m$ I* f/ a
- vector<TaggedObject*> selectedObjects = this->axis0->GetProperties()->GetTaggedObjectVector("SelectedObjects");
- w; d; v6 @6 o N! g - Axis *axis1 = dynamic_cast<Axis *>(selectedObjects[0]);* X& L- u2 T" g7 S* |
- revolveBuilder1->SetAxis(axis1);
* k0 _" p8 U% A7 t - double startValue = this->expStartAngle->GetProperties()->GetDouble("Value");( T( M! u, ]# v7 p. S( [* E% E& d
- double endValue = this->expStartAngle1->GetProperties()->GetDouble("Value");
2 v5 |/ B" i9 O& {: ?. L - stringstream s_startValue,s_endValue;1 N' @+ L/ d+ B( `
- s_startValue <<startValue;
# ?) e+ {6 B3 g' P - s_endValue <<endValue;+ O ~* r! J' Y: M
- revolveBuilder1->Limits()->StartExtend()->Value()->SetRightHandSide(s_startValue.str());7 S6 H5 t, x2 ^1 _' P. R- S
- revolveBuilder1->Limits()->EndExtend()->Value()->SetRightHandSide(s_endValue.str());
1 V/ X; G( [- U) z2 z - Features::Feature *feature1;
2 b6 I4 c( Z8 k - feature1 = revolveBuilder1->CommitFeature();* r0 a, J8 ]: f- L& f
- revolveBuilder1->Destroy();
; T9 j0 [% }$ ^0 _- I$ ^ - section1->Destroy();
, M3 V/ W% \$ p1 J B; @8 r4 @) ] - }
复制代码
: a. O$ F% a; W5 h
2 y' F) _1 c* E* Q, u, C
$ p) v I( \9 @$ [6 J, l4 W |
|