|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
6 t$ K! j' f; W- J
2 v- m9 I0 t1 s- {% {UG NX二次开发旋转特征代码分享
$ d" o: I7 Q4 c% R, W- g
- U) x1 _- o( c Z$ o/ q如何使用NX二次开发进行旋转
e8 I; F4 ~2 V6 r) v0 V+ Z0 z* \
- void lesson33_createRevolve::createRevolve(SkeTCh *sketch)
6 j" ~% A# t/ F6 g% Q - {0 N' F* N/ V7 v1 I3 `
- Features::Feature *nullFeatures_Feature(NULL);, C1 h) B6 X& K# W" ~0 ~
( N. P: J. z& I8 c) }* l$ ]! t, Z- Features::RevolveBuilder *revolveBuilder1;# E- A* j* O. z8 N! `: ~$ Q
- revolveBuilder1 = workPart->Features()->CreateRevolveBuilder(nullFeatures_Feature);4 \/ e4 o: k6 u4 d: k. \, n% C
- revolveBuilder1->SetTolerance(0.001);4 F' J0 G- a# n8 {; {
- Section *section1;# ]" e# o! _) b2 B0 k- i
- section1 = workPart->Sections()->CreateSection(0.00095, 0.001, 0.05);
" x! U* l) k/ c - revolveBuilder1->SetSection(section1);, d4 z' i) l, t$ S, v
- std::vector<Features::Feature *> features1(1);
" U# F1 G4 [+ {) {, h/ k - features1[0] = sketch->Feature();( |2 Z9 N# }7 g( r6 ]$ i# M9 W
- CurveFeatureRule *curveFeatureRule1;
/ `% Q4 j$ x4 k+ x% b) V( | - curveFeatureRule1 = workPart->ScRuleFactory()->CreateRuleCurveFeature(features1);
9 T3 P" d2 m. |: p0 i5 I n, G - std::vector<SelectionIntentRule *> rules1(1);: w6 a' O/ m" W
- rules1[0] = curveFeatureRule1;5 f5 P0 {" e% {* _' g4 H
- NXObject *nullNXObject(NULL);3 j O" ~8 O# m$ f1 x" P
- Point3d helpPoint1(0, 0, 0);
d1 E7 o$ y' b1 l ^* O - section1->AddToSection(rules1, nullNXObject, nullNXObject, nullNXObject, helpPoint1, Section::ModeCreate, false);
$ ?6 P+ w, N# n! @2 c4 _1 u: L) s - revolveBuilder1->SetSection(section1);
/ s0 D& ]: d5 { H - // get UI value
# M8 l8 d# `8 j6 L% L/ K - vector<TaggedObject*> selectedObjects = this->axis0->GetProperties()->GetTaggedObjectVector("SelectedObjects");
/ F3 {" c8 B2 Q+ t - Axis *axis1 = dynamic_cast<Axis *>(selectedObjects[0]);
3 t h& D* V4 l' y% r - revolveBuilder1->SetAxis(axis1);7 D) J/ _5 Z9 M7 i2 i( Z& A
- double startValue = this->expStartAngle->GetProperties()->GetDouble("Value");6 v+ }2 V* {) C
- double endValue = this->expStartAngle1->GetProperties()->GetDouble("Value");4 t0 Q4 a+ Z) C5 v Y# _
- stringstream s_startValue,s_endValue;# L' j( A" g, ~. ~$ ]' s" g
- s_startValue <<startValue;( S5 ~; W8 G' |! a8 W- R
- s_endValue <<endValue;
& Q3 J/ ~- ?7 Z3 W- f5 |5 G - revolveBuilder1->Limits()->StartExtend()->Value()->SetRightHandSide(s_startValue.str());- C0 M5 x: P( s2 ^1 l( x& S
- revolveBuilder1->Limits()->EndExtend()->Value()->SetRightHandSide(s_endValue.str());
% g5 e! ^# d, C' c( [" p! { - Features::Feature *feature1;; z |# U* c; h5 K: F7 {' f
- feature1 = revolveBuilder1->CommitFeature();
6 D8 E. H" A! A4 k; S) Q$ v) ^ - revolveBuilder1->Destroy();
7 R4 @5 ], ]3 p# F6 o, E - section1->Destroy();! g& f& P& g* z) k- |9 u
- }
复制代码
$ k }) B9 e! H5 k, O; y, V2 T$ J" }5 ~ ?8 I! X) E I
3 W1 O* o9 i+ ]
|
|