|
|
秋爱
发表于 2015-8-15 09:15:43
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
) _& F) l+ {' u U. c, k. K
void selectedge::initialize_cb()4 B! M, l4 e$ \6 ?4 G g8 @
{; E$ z$ j* N$ a; b% ] ]5 G. t
try. Z' ^! {" Q# ~
{
- ^; @" j8 U! Q3 r group1 = dynamic_cast<NXOpen::BlockStyler::Group*>(theDialog->TopBlock()->FindBlock("group1"));
- V J' A4 m5 }' O2 P% V9 r* V2 P1 x edge_select0 = dynamic_cast<NXOpen::BlockStyler::CurveCollector*>(theDialog->TopBlock()- >FindBlock("edge_select0"));
3 a, O9 p# l9 V r# M+ z6 a expression0 = dynamic_cast<NXOpen::BlockStyler::ExpressionBlock*>(theDialog->TopBlock()- >FindBlock("expression0"));}
+ G- j: i/ ]+ x. ?/ j7 l caTCh(exception& ex): \. N' f: Q3 J: G2 H$ V: T! J
{
" p' e% f, T0 L& Q# j //---- Enter your exception handling code here -----. `+ E( p$ A0 o
selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:dialogTypeError, ex.what());
B7 Q0 D1 x6 F' u }
/ [7 w% i B" a. b- D4 y}( B& _$ |; ~- o* ~4 E
8 i# } n% m, h9 kint selectedge::apply_cb()
2 s1 x3 {4 R# G n$ Z0 [ H1 r{
/ a: x0 y2 \" R* d0 p) |/ S/ m, b int errorCode = 0;
) }+ C% x/ D! x try
8 ]* ]7 V) ]/ X" j/ p$ X {
; a8 j5 H. L5 N/ \3 @ //---- Enter your callback code here -----/ d! s- m- v3 K* G
8 c$ U! x" a0 c/ l9 E+ ~4 ^/ H4 E; B2 r8 w( v, ~: W
7 T/ h7 F1 E q4 J: ]
Session *theSession = Session::GetSession();& Y8 q( m9 Q& T5 g8 H8 x" }
Part *workPart(theSession->Parts()->Work());/ y3 \5 e0 o7 O) q% O9 B
Part *displayPart(theSession->Parts()->Display());) I) J$ R6 X1 r0 t' @) m6 O
: B% ]9 ^+ s9 ~+ A5 M: ]
- G) c0 P5 {4 e3 @4 `( } Features::Feature *nullFeatures_Feature(NULL);
$ ?1 s7 T5 ], l/ G Features::EdgeBlendBuilder *edgeBlendBuilder1;
# O# \( J1 r9 e- ~: o; x+ s( u edgeBlendBuilder1 = workPart->Features()->CreateEdgeBlendBuilder(nullFeatures_Feature);. }7 x+ t/ n2 a* Z# t5 X
8 u0 D0 y# Y# i5 b
* U J% C! d; k- f. ^. y
ScCollector *scCollector1;' h+ y' C7 M9 W! n8 n* a% G# ~; c( I( |1 q
scCollector1 = workPart->ScCollectors()->CreateCollector();
1 c0 X7 L# J" s- b9 i, G; T: g% b
; w5 X% ?0 q5 g* M6 h
! Z* l; }- \+ q! o9 a, c' I6 q std::vector<Edge *> seedEdges;# T, y; T* T8 K6 {, B6 n7 T; r+ ]- P
8 m$ V9 ~5 O5 B' _ h' x std::vector<TaggedObject*>selectob = edge_select0->GetSelectedObjects(); //获取选择的对象$ ]- g- |5 T4 W& @! ~3 y8 Q) y+ r
for (int i=0;i<selectob.size();i++)
4 p9 K7 r& o0 X! _ {
* U" x) P/ \9 _+ z4 }3 Y seedEdges.push_back(dynamic_cast<Edge*>(selectob));: B f7 P8 q+ I# X: C( Z7 M l
}
8 W5 | Z2 p9 Z& G" _1 K9 }* b4 C+ ?- u* y2 Q
double dia = expression0->Value(); //获取表达式的值
- }3 a8 ~4 D' E0 D6 I9 S! p stringstream DIA;
. O0 T l# u! U( d1 r7 p1 x0 V DIA << dia;
- N( D" q7 \0 F2 z( H9 z
) o S5 T5 l# p) J
( i" Z6 |. h5 D! z @ EdgeMultipleSeedTangentRule *edgeMultipleSeedTangentRule1;
: W& I$ a b L. P! j3 L edgeMultipleSeedTangentRule1 = workPart->ScRuleFactory()->CreateRuleEdgeMultipleSeedTangent(seedEdges, 0.05, true);
6 y) }/ E, m" S5 y+ B& L. D# s" m
, F9 p/ z7 U; G$ ?$ K+ g
7 m1 U9 }7 d- E% h- l0 h" ] std::vector<SelectionIntentRule *> rules1(1);
+ k/ {) Y! E: I% ?, r% ] rules1[0] = edgeMultipleSeedTangentRule1;# _- V& T' F' q2 M! w
scCollector1->ReplaceRules(rules1, false);
. |- e8 k" O4 \6 k8 \4 ?$ @( i V
; V. ^( m5 D! ^& Y
2 G# ^# M! @0 L8 c) `/ }3 v edgeBlendBuilder1->SetTolerance(0.001);
( d* l: o2 X7 S8 s# b3 w2 T% t. a3 d( Z: k: O7 C- X/ @ [+ k
* ?4 }8 v4 J0 x8 Y8 Y5 Y( L, ~
edgeBlendBuilder1->SetAllInstancesOption(false);8 s2 J7 V+ J9 L, j
& }2 E. K% R# s1 I" `/ i4 G1 `
3 r; p8 M/ P) x" M edgeBlendBuilder1->SetRemoveSelfIntersection(true);1 X7 i7 q% _# R7 y& y
! }, o% y ^8 y: O
; Y7 g! N( s ]' n5 n edgeBlendBuilder1->SetPatchComplexGeometryAreas(true);
l' r- \& B) r5 r. [
5 M% m# M% N- v5 c2 w, e7 Q0 m' j8 y: ~, i" b! r/ ?8 d
edgeBlendBuilder1->SetLimitFailingAreas(true);! O& ` b) n7 k. V5 ^' v
2 D% n) u% Q' }" z
$ j) \# \; y2 Q' l, y' d edgeBlendBuilder1->SetConvexConcaveY(false);. w8 b8 ^2 |4 R
5 _. l! t4 V+ J4 U2 L
( v/ U% I9 M# A! D" c edgeBlendBuilder1->SetRollOverSmoothEdge(true);
7 Y4 Y& q7 J1 v) ?0 S) @$ p! W7 e0 [% L9 g+ @5 y
) c8 F7 d% L( _, C( y" | edgeBlendBuilder1->SetRollOntoEdge(true);0 ^0 F4 l4 \- m! ~$ a- k( ~$ @: y
: O$ Q& W3 Q8 B: h# c. }+ Z: A6 R9 T' A& k1 z
edgeBlendBuilder1->SetMoveSharpEdge(true);0 K8 C( G! `8 y' _/ ^
, }8 n4 ?0 @; O' F5 }+ g9 Z, O
7 v8 q4 _+ M$ U6 j
edgeBlendBuilder1->SetTrimmingOption(false);
& }3 g1 `; |4 r D! ]" Y" R3 j% m% ~- N
! H* n j4 ~& U, \8 S
edgeBlendBuilder1->SetOverlapOption(Features::EdgeBlendBuilder::OverlapAnyConvexityRollOver);5 H) G% K* o% D2 r) ]! l
1 k- p0 A" Y9 H% P
* f" D0 X q9 T: Y* e3 q/ N edgeBlendBuilder1->SetBlendOrder(Features::EdgeBlendBuilder::OrderOfBlendingConvexFirst);
5 F3 K- J" w4 m% u# m
8 n% J" H1 u" N; ?0 H' f
; s2 k5 \' l" m edgeBlendBuilder1->SetSetbackOption(Features::EdgeBlendBuilder::SetbackSeparateFromCorner);
+ h& x$ ]9 D( n7 J9 @, \
B3 C7 D. M' |/ @8 s' ?* F4 V( w4 I' z8 g3 u- [
int csIndex1;
7 m4 Q6 i. N8 u+ m3 n5 H csIndex1 = edgeBlendBuilder1->AddChainset(scCollector1, DIA.str());
- c, z! }1 {& M {/ d: |/ s8 Q2 e) u9 N1 Z3 A
C W- J: Y# m: o; K- B
Features::Feature *feature1;
- c2 ^ \! m0 F: s) J/ y3 @ feature1 = edgeBlendBuilder1->CommitFeature();. Y# z8 S6 e$ j; v0 Y S
" n( o2 d- j6 j6 y. D2 c' a' p
. W2 @2 y4 ~: f3 b, _% m/ y
edgeBlendBuilder1->Destroy();& A4 N; C/ d8 ]# C
6 Q5 ? x1 _, J+ h- c0 {" u, C4 V }1 r- L, x3 i" o E4 C% p
catch(exception& ex)6 | L% k3 K$ s0 z j
{& A. V5 \+ ] {1 G4 }) j0 Z0 _6 X
//---- Enter your exception handling code here -----; }4 B7 u' Z' H: ^- h3 S( Z; R# Z
errorCode = 1;
* a9 s8 {( B3 l4 r selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());: @% J$ I0 G+ |' H2 a' ^" k0 M
}0 M- N, `5 Y# A; k. B
return errorCode;
$ A1 Z% U) H# T}
: ]% a' Y" O) N* f, L9 M6 [; H& T0 g5 b& P' m/ O" C
说明:因为字数有限制,这里只贴出关键代码。
" F1 K S0 z: r- r# j( e; R- R
5 E3 X {/ H& N6 t
. z% T/ x1 d: P- ?+ Z9 _( ?# m4 r" ~5 v0 d3 d% q
|
-
评分
-
查看全部评分
|