|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
, x8 N# M9 Q0 b) i1 p; ~- Q# C3 b8 g$ u% H) F7 _9 w4 {
UG NX二次开发旋转特征代码分享
9 h3 w/ A, z- \/ I
! }8 H9 `! N- |. z- x2 x如何使用NX二次开发进行旋转! r o2 ?, r- w! O$ \
* w# g. E9 ^* Y+ [$ ^3 C) q
- void lesson33_createRevolve::createRevolve(SkeTCh *sketch)
: h7 S% `' p3 ^6 z" x1 j! q" h - {1 v9 X, a6 s- P
- Features::Feature *nullFeatures_Feature(NULL);& u: |1 |* p# J2 Z8 M
0 `9 U g& e W+ U& B$ ~- Features::RevolveBuilder *revolveBuilder1; Z$ Z$ S4 O9 L% d0 a+ _1 N
- revolveBuilder1 = workPart->Features()->CreateRevolveBuilder(nullFeatures_Feature);
8 z% s- |5 x2 V- K2 T. B! e8 e - revolveBuilder1->SetTolerance(0.001);1 D4 D, i" F i; J- w+ n" W
- Section *section1;7 U& D- z! p/ r2 N4 r g
- section1 = workPart->Sections()->CreateSection(0.00095, 0.001, 0.05);
1 e9 x5 S( C% K h- c7 z, t - revolveBuilder1->SetSection(section1);6 I+ x: j. K% {5 a1 Q$ v
- std::vector<Features::Feature *> features1(1);5 @0 q- _3 D5 }7 I9 o
- features1[0] = sketch->Feature();
0 O2 M: Q: S9 | - CurveFeatureRule *curveFeatureRule1;
) R! z5 C9 ~5 x2 O! S/ A: g - curveFeatureRule1 = workPart->ScRuleFactory()->CreateRuleCurveFeature(features1);
& I4 {; H" z" g: v( e- [: S: S8 _ - std::vector<SelectionIntentRule *> rules1(1);
. a' k0 t& k5 J7 u8 w+ N7 F - rules1[0] = curveFeatureRule1;
4 f5 S4 K8 R( C4 [ - NXObject *nullNXObject(NULL);
% z6 {1 E" b! U2 l9 H - Point3d helpPoint1(0, 0, 0);
/ G" u+ i% o2 }$ T - section1->AddToSection(rules1, nullNXObject, nullNXObject, nullNXObject, helpPoint1, Section::ModeCreate, false);
3 r4 q, [ E( ` ~3 W - revolveBuilder1->SetSection(section1);; O. z( s" x+ Y0 ]
- // get UI value- U$ f3 Z" s' B* H
- vector<TaggedObject*> selectedObjects = this->axis0->GetProperties()->GetTaggedObjectVector("SelectedObjects");6 t0 @5 T9 s3 |" E9 `/ C4 U9 O$ r) d
- Axis *axis1 = dynamic_cast<Axis *>(selectedObjects[0]);
) X+ z; p6 H0 x/ V1 [ A - revolveBuilder1->SetAxis(axis1);
8 w: Q# e7 }$ f - double startValue = this->expStartAngle->GetProperties()->GetDouble("Value");
9 n* k4 q. @" G8 i4 V* }1 r - double endValue = this->expStartAngle1->GetProperties()->GetDouble("Value");
& e8 N# V G8 W& G. N5 i) D - stringstream s_startValue,s_endValue;: x( `( V& N- e: W9 A
- s_startValue <<startValue;
0 m3 u0 m: ~0 l% Q/ ~2 E - s_endValue <<endValue;1 p5 ]7 p" b9 y- `
- revolveBuilder1->Limits()->StartExtend()->Value()->SetRightHandSide(s_startValue.str());
& p: E9 z+ m+ B; `, z+ P }" s - revolveBuilder1->Limits()->EndExtend()->Value()->SetRightHandSide(s_endValue.str());1 F ~# |9 w8 r5 J/ P6 J/ N; ?
- Features::Feature *feature1;% |; P5 d5 u& c6 U# s
- feature1 = revolveBuilder1->CommitFeature();
7 ^1 V- \8 ]1 X6 f' z) O - revolveBuilder1->Destroy();
6 @; H2 A8 t# y4 j - section1->Destroy();- s2 v9 M" \- _$ Z& G: Z
- }
复制代码
) M2 |7 r' h- s, H% ~
$ u: a F- L* v* _/ ~2 X) W# f7 m0 B( G }% G" q9 q3 o8 I& z3 h
|
|