|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
0 N Z7 q9 ]! D6 x
. O4 Q2 S5 E" @UG NX二次开发旋转特征代码分享
, S3 \+ r) p1 _
4 X# @* Q0 F0 X如何使用NX二次开发进行旋转/ S( L( q7 t1 S$ F; b0 c, C
* l: P( p3 |* g& ?9 n
- void lesson33_createRevolve::createRevolve(SkeTCh *sketch)
# I5 V, s# n2 ], }) T - {
( W" L/ e4 Q9 d3 g0 f8 v d - Features::Feature *nullFeatures_Feature(NULL);( e3 z! i2 K: m4 [$ U5 y0 Q& ^! p) m
9 A& U/ m' L( m- Features::RevolveBuilder *revolveBuilder1;1 Y9 Y. t' K9 S+ R( x
- revolveBuilder1 = workPart->Features()->CreateRevolveBuilder(nullFeatures_Feature);) P. m6 s9 ]/ M9 ~
- revolveBuilder1->SetTolerance(0.001);" V% W, e/ ^4 V6 t
- Section *section1;. l3 k$ U: k# `* e+ V
- section1 = workPart->Sections()->CreateSection(0.00095, 0.001, 0.05);
/ g7 k5 q4 I7 M' X2 R$ L. L - revolveBuilder1->SetSection(section1);
0 _# Q' G# Z* D% C3 t' m - std::vector<Features::Feature *> features1(1);$ T5 C& F$ s* G% P6 R
- features1[0] = sketch->Feature();% e I% W! M6 e3 j3 i5 ?. `
- CurveFeatureRule *curveFeatureRule1;
: |" Z4 i7 u- R0 T7 }+ @) o - curveFeatureRule1 = workPart->ScRuleFactory()->CreateRuleCurveFeature(features1); _' t9 R. q% j9 r9 a& ~7 }+ R8 t2 y
- std::vector<SelectionIntentRule *> rules1(1);
( u" Z! N1 P# [0 [: e8 b - rules1[0] = curveFeatureRule1;$ r/ m. p5 y1 J# b: c
- NXObject *nullNXObject(NULL);. v! Q2 I; k1 u. G
- Point3d helpPoint1(0, 0, 0);6 e9 U+ W6 L7 V1 f2 T( P9 b- J
- section1->AddToSection(rules1, nullNXObject, nullNXObject, nullNXObject, helpPoint1, Section::ModeCreate, false);
2 q) z1 y2 ]- V7 @1 R$ F - revolveBuilder1->SetSection(section1);
; w; g+ e" Q$ v- ^) ` - // get UI value) L, C( I* N0 f: a& v3 f4 Y) C5 K
- vector<TaggedObject*> selectedObjects = this->axis0->GetProperties()->GetTaggedObjectVector("SelectedObjects");
% S$ p( u9 T) Y/ @+ ] - Axis *axis1 = dynamic_cast<Axis *>(selectedObjects[0]);
# t* ~: ^& k$ c, ` - revolveBuilder1->SetAxis(axis1);! u# ]. `: y7 [" w0 p, C
- double startValue = this->expStartAngle->GetProperties()->GetDouble("Value");& Z+ H% U' _ y1 Q' m
- double endValue = this->expStartAngle1->GetProperties()->GetDouble("Value");2 A) o& V# X9 R; ?" P7 D
- stringstream s_startValue,s_endValue;
% X9 k5 h/ q# |( x8 p - s_startValue <<startValue;
9 a7 {5 h% O) W: q( u - s_endValue <<endValue;, i8 i2 E% L) U" ]
- revolveBuilder1->Limits()->StartExtend()->Value()->SetRightHandSide(s_startValue.str());* H l4 t. j0 R% D0 L) d
- revolveBuilder1->Limits()->EndExtend()->Value()->SetRightHandSide(s_endValue.str());% m4 |3 p% F3 L# r3 v. F! E& C
- Features::Feature *feature1;7 W! D0 |5 O: {2 U; T+ p
- feature1 = revolveBuilder1->CommitFeature();
+ B9 b1 r; J- Z1 }7 C5 j7 ^+ k% \# ^ - revolveBuilder1->Destroy();
; Z1 M* U! ~8 `$ _ - section1->Destroy();
% [, |& t' A+ l( ? - }
复制代码
6 ]* U2 u, ^7 T: n3 J( s3 [
8 m9 }4 E5 t) @: f% _( T* `2 b- b; L) r/ v2 D" u# J$ E% h. B" J. r
|
|