|
|
秋爱
发表于 2015-8-15 09:15:43
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
: U. {7 f4 K \+ ?void selectedge::initialize_cb()
3 R% W% a% I. a( ]{
- ]% s! q% [, r/ B0 t) m try% w6 i! A% Y2 {! f2 f' A
{: y) x7 |+ H: Q2 G7 E% ~
group1 = dynamic_cast<NXOpen::BlockStyler::Group*>(theDialog->TopBlock()->FindBlock("group1"));
$ J) Q+ h: v. A+ J, f edge_select0 = dynamic_cast<NXOpen::BlockStyler::CurveCollector*>(theDialog->TopBlock()- >FindBlock("edge_select0"));
/ v! @! s# Q* F5 j" o% k3 d expression0 = dynamic_cast<NXOpen::BlockStyler::ExpressionBlock*>(theDialog->TopBlock()- >FindBlock("expression0"));}
6 ~: E$ w* j' B caTCh(exception& ex)
) C( Q' }1 \/ P {
2 e& ?3 D* U- s) U* O; d- v //---- Enter your exception handling code here -----
- v+ l. [9 j% C+ u selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:dialogTypeError, ex.what());
6 l! A: E4 S% {) H }( |% q- R$ u$ ^& ?1 j6 _
}5 G# f$ `! Y% K7 G+ R' X7 J
' \+ x7 z" r( h, B, z# ]$ p
int selectedge::apply_cb()
1 _) q% j4 Y" t7 |/ g- l9 z$ ]& H{
8 A* b. m, C2 L a0 U+ }! l; L int errorCode = 0;
# j( @: N1 V, ~ } try1 M4 G4 W6 ^5 q; k
{
. j9 A& H4 t8 o1 O2 q! W- z7 ? //---- Enter your callback code here -----
7 |6 @( Y$ P. n' b9 c: Y( A$ E
# T4 Y! o, o+ n: A! {' P" c3 L. U% X( P& k5 X
; O+ M) t: P- A3 e. W C& `
Session *theSession = Session::GetSession();- u. d) ^+ Q7 [$ l* E
Part *workPart(theSession->Parts()->Work());
% ?( Z! a- |3 i$ U1 o Part *displayPart(theSession->Parts()->Display());
8 e4 x5 L# d( N. v' i, F( m6 G/ v1 u5 }1 {5 a8 d) D: m: I
1 C( W+ A% u* @1 o
Features::Feature *nullFeatures_Feature(NULL);/ ~6 G; Q0 Q- u% W
Features::EdgeBlendBuilder *edgeBlendBuilder1;
7 T5 V$ S P6 k! N/ L; q edgeBlendBuilder1 = workPart->Features()->CreateEdgeBlendBuilder(nullFeatures_Feature);5 J" y/ c4 {' U$ o8 h
. q/ Q _" h' j3 W- D/ Q3 b" r% G
+ p0 G$ K2 @: M1 u; D! L' r ScCollector *scCollector1;) I& i9 F: B# L9 d" O2 [
scCollector1 = workPart->ScCollectors()->CreateCollector();' X/ P: J7 p; {4 m9 A/ d F
; E8 U% g1 t% N- ~4 O# v* q3 ? Y
! `, o2 ]- ?9 s! L" C# L* q
std::vector<Edge *> seedEdges;$ x( Y/ y: o" R" T9 o* `/ d
2 ~8 \5 W+ D& n$ v, g" |
std::vector<TaggedObject*>selectob = edge_select0->GetSelectedObjects(); //获取选择的对象' I* Q- e. p3 _
for (int i=0;i<selectob.size();i++)
' R1 T# v3 | O {- @5 U1 s0 K( W) s# X
seedEdges.push_back(dynamic_cast<Edge*>(selectob));
8 ~! H4 l) u3 h; U9 x }
9 S* a) u1 [# N( k* D
, K1 K. N w0 J6 T4 e6 _5 I7 g0 y double dia = expression0->Value(); //获取表达式的值9 b; x8 G4 c& T3 a7 M3 ~$ [" D0 F
stringstream DIA;
- |$ `7 i9 b; l* o+ p! f; m9 c DIA << dia;8 _. {0 l- B* u, H1 }& f
9 [3 ]+ ]2 J( I
* B8 u# z F, D6 }
EdgeMultipleSeedTangentRule *edgeMultipleSeedTangentRule1;
! D2 e1 q% j0 _2 ~' K" y- V edgeMultipleSeedTangentRule1 = workPart->ScRuleFactory()->CreateRuleEdgeMultipleSeedTangent(seedEdges, 0.05, true);
6 P0 @ ~; S1 n" [ S2 u- T/ B1 R3 P k3 K5 l
! j) Z2 U( Z' d W5 z std::vector<SelectionIntentRule *> rules1(1);3 y4 \7 ~+ X* a4 X
rules1[0] = edgeMultipleSeedTangentRule1;% |: R; s8 ^1 X9 z' d2 a
scCollector1->ReplaceRules(rules1, false);
" ]/ T A @5 c
0 Q# V3 |* Z. d" l8 Q: @- Q( i( x! J% ?
edgeBlendBuilder1->SetTolerance(0.001);
5 E* {8 O, s' z( u
1 q& r8 b5 J* G& s0 L f
, U& r, v, ^/ C# ~ edgeBlendBuilder1->SetAllInstancesOption(false);( O5 u) O0 Z, ^9 H' w1 T1 F/ T: c$ l
8 U' f. C7 e, j; ~' u# N4 p' ` J5 m' W5 \# u! w$ B7 J2 I, }
edgeBlendBuilder1->SetRemoveSelfIntersection(true);& o' T% W9 V8 B/ I
( T0 g, h' `9 ]8 p, `6 J
j5 D! e- o! V' w edgeBlendBuilder1->SetPatchComplexGeometryAreas(true);
* A( h6 ?$ l/ M9 I) k' o* K; x8 M7 }2 W# i
6 B' z0 l( ], S& T( i
edgeBlendBuilder1->SetLimitFailingAreas(true);! l- v/ l* G0 D# C3 ?+ e
( V6 \2 f2 |7 M1 p+ D- z9 X4 y/ R' i6 M& i2 y
edgeBlendBuilder1->SetConvexConcaveY(false);
( Q( n, k8 B! A. D: n) w- _4 {6 D* x$ L0 O& z! v( G- A, @
$ N: z4 ?# ~$ b8 Q( A# I) } edgeBlendBuilder1->SetRollOverSmoothEdge(true);
1 `8 F/ k3 Q$ l9 I) X) F U2 _# v; b* W) r* V$ {: d# T- } s8 ]3 E
$ M4 M+ U0 V) U" f edgeBlendBuilder1->SetRollOntoEdge(true);
( w3 Q' k$ V; I8 v# @6 w m4 S: b1 v3 a) }
' h! `/ K0 e/ Y edgeBlendBuilder1->SetMoveSharpEdge(true);0 H7 \& T" R6 g( ^7 a
; c1 s0 ~( A) e# \- o$ P: h( R$ a
* I, Z4 l+ e6 D( I7 A edgeBlendBuilder1->SetTrimmingOption(false);
: t* A" }) z! z8 Q: u) l5 a: b. w$ Y! y4 G! [- q' g0 u
- J7 W: E! I4 e- Q/ F
edgeBlendBuilder1->SetOverlapOption(Features::EdgeBlendBuilder::OverlapAnyConvexityRollOver);: h, U q$ u# R7 Z) w
" j% O6 m9 _# ~* ?9 K7 s8 M8 o. |1 A8 ?: p
edgeBlendBuilder1->SetBlendOrder(Features::EdgeBlendBuilder::OrderOfBlendingConvexFirst);5 d% o" f m4 f$ d" z
# i+ `) o9 Y; a
7 T2 l) [2 m* Q3 S1 w
edgeBlendBuilder1->SetSetbackOption(Features::EdgeBlendBuilder::SetbackSeparateFromCorner);5 h! ]2 x; |5 D8 ~+ A* i
, |* D; G* g, r r+ z: V. } o$ J' n
int csIndex1;
5 R3 c- T3 I1 `4 E1 O csIndex1 = edgeBlendBuilder1->AddChainset(scCollector1, DIA.str());
9 ]: y. _7 A2 B4 W6 l3 i$ C* Q9 X( S# \/ S% V5 e3 J
9 I) h% B- C8 ~( B% \% ^4 @/ H Features::Feature *feature1;
9 V% d" W) c& M3 R( [- y `& T% e1 l feature1 = edgeBlendBuilder1->CommitFeature();
& I0 j$ i2 C! u8 @7 q8 ]/ l/ s& A: @$ n2 Z6 B+ v& d
. p1 [% I( B( [! K) d
edgeBlendBuilder1->Destroy();
8 l, [1 {9 k& D6 q6 N- o! p) |. L4 F/ ?, D6 ] d
}" F! ^6 i, D N
catch(exception& ex)+ b& C. D, i `7 S( _( @! V! ?
{
]6 W5 W: p- g' H //---- Enter your exception handling code here -----
1 z c$ f7 P" T errorCode = 1;" E% @5 F+ l2 J+ e4 }, g* `
selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());! F& L/ l8 c" h( f+ u! Y
}
. {+ _7 \/ `# Q. _% D" N return errorCode;
$ ~4 T4 O: t* ^( _' J}" @1 R0 J8 O0 l$ G O. W
- b* s2 s$ _: Y
说明:因为字数有限制,这里只贴出关键代码。
- |" F! ]4 m# p
, W* e( q& J, h9 n6 @+ `3 r7 w, e( L S1 ? D" \
, [2 P# q! @$ \" H* @
|
-
评分
-
查看全部评分
|