|
|
秋爱
发表于 2015-8-15 09:15:43
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
+ W( |- q) q- T7 z9 ^
void selectedge::initialize_cb()
$ @! ~4 p) H1 V9 w0 G{4 c( K9 E; g( Q: I
try/ ~8 a4 n8 @& ]- h; U* V
{
0 q1 L( s% c5 W1 Z3 V7 P) ]( z1 m group1 = dynamic_cast<NXOpen::BlockStyler::Group*>(theDialog->TopBlock()->FindBlock("group1"));6 w3 a8 m) d/ l+ O0 ]) M
edge_select0 = dynamic_cast<NXOpen::BlockStyler::CurveCollector*>(theDialog->TopBlock()- >FindBlock("edge_select0"));. a9 ~" F V7 @* l( a4 K# {
expression0 = dynamic_cast<NXOpen::BlockStyler::ExpressionBlock*>(theDialog->TopBlock()- >FindBlock("expression0"));}5 B' @/ H0 a; m* E( o: r+ U
caTCh(exception& ex) F9 G& q( B' Y9 B. R& C6 H
{
. C$ v- n/ F8 b, y' Q //---- Enter your exception handling code here -----
1 K8 d2 \9 A3 f7 b5 I: m- q6 p selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:dialogTypeError, ex.what());
3 g; G- X f% h5 t; j/ T } W+ B* |2 ^7 L I
}
0 h# P- y8 U7 T
! ^8 Y# x7 A5 Y8 L# ~$ Sint selectedge::apply_cb()
) T* }3 W8 H. Q: b" ]2 X9 T; U$ o2 Q{# N/ }: _: B l
int errorCode = 0;0 ]% V2 ]) E' ` m$ p, [
try
0 U9 @6 v! y( v6 g+ ?1 X {% S- p1 h9 a0 s$ o+ @9 H+ z, k8 x
//---- Enter your callback code here -----
' l* Y- z* s. D, J4 A0 t$ P6 Q
/ A7 O* U$ f! ?$ h/ V/ ]/ i7 \( @
* D J4 D5 l& D9 J0 P
Session *theSession = Session::GetSession();/ r0 f% d4 J. v) M y( @
Part *workPart(theSession->Parts()->Work());. z% t8 A8 R6 {) I: z! @- P
Part *displayPart(theSession->Parts()->Display());: T1 t/ E3 Z9 [$ p8 z, J
# s5 `1 `& O: x) a3 @. ]! R! v1 O* p4 v1 x/ H$ i7 ^
Features::Feature *nullFeatures_Feature(NULL);
8 G- T, T+ ]& T6 C8 X3 ` { Features::EdgeBlendBuilder *edgeBlendBuilder1;
: [; d1 t) W( c( X7 R edgeBlendBuilder1 = workPart->Features()->CreateEdgeBlendBuilder(nullFeatures_Feature);
8 I/ A& `0 z. Z5 A( h; f
; P; v( t+ j1 B) h6 r$ ^# Z5 S" D, ?; E$ f5 T$ @' o
ScCollector *scCollector1;
2 }- u$ E5 ?2 x9 ]7 ~7 U" O, @$ O5 Y scCollector1 = workPart->ScCollectors()->CreateCollector();" W8 h8 R; n8 L: a0 q/ h
5 [; b" S' ^+ U. N- \
" V$ u d' M- {) A& S std::vector<Edge *> seedEdges;2 L$ j* O3 |( d2 }: b% x
% h H: f$ M1 x& e% v& b! ~
std::vector<TaggedObject*>selectob = edge_select0->GetSelectedObjects(); //获取选择的对象% B3 ?+ ~: z: j) r$ E
for (int i=0;i<selectob.size();i++)
# p1 z& n# t+ u9 z& S1 K& N4 ^4 p | {+ u* T" K* w- O. n; o
seedEdges.push_back(dynamic_cast<Edge*>(selectob));
) K8 D1 y8 {' R, a( } }
v8 l: z0 Q: Y2 m) N+ m6 }" _. Q' U1 K L5 v7 e% Q6 Q g0 y1 m" H6 ?
double dia = expression0->Value(); //获取表达式的值
! h6 B3 W* ^# Y. D0 p stringstream DIA;
7 h, p1 a! Z7 r' Z DIA << dia;
; O A. a8 F# o. Y
/ b9 O8 [& w; T* Q" H l' b7 K* _, `" \5 [& t' D
EdgeMultipleSeedTangentRule *edgeMultipleSeedTangentRule1;; R( e. x! Q6 j, E
edgeMultipleSeedTangentRule1 = workPart->ScRuleFactory()->CreateRuleEdgeMultipleSeedTangent(seedEdges, 0.05, true);
" U! G$ c$ g0 i# b: X6 C9 x7 j l/ k- {$ c" _1 N& L9 i
$ o1 z* Y4 Z0 ?: ?- X
std::vector<SelectionIntentRule *> rules1(1);
# h: m( Z" e- ~8 `0 w, g rules1[0] = edgeMultipleSeedTangentRule1;# l/ C8 F2 C- [$ Y V7 x
scCollector1->ReplaceRules(rules1, false);
. |* I `- Z: e9 `( i0 G6 c9 Z8 d, [0 [0 i# J
) \) B f1 K; O9 J1 d& D edgeBlendBuilder1->SetTolerance(0.001);
/ x2 S! O7 h; i5 @
0 G/ D' p1 ? z5 g$ o; y. H# U4 j1 {3 \6 j' O9 F
edgeBlendBuilder1->SetAllInstancesOption(false);
% i5 W+ R) \$ C- [* X
# v: N0 @5 V: R v
4 T7 Z# c* j& R/ f8 j/ B$ Y$ w edgeBlendBuilder1->SetRemoveSelfIntersection(true);2 D: R" W9 w* l4 J: @ _0 L1 ]
9 V( {8 }: w2 f+ l( i7 j; S. H' N2 p0 d
edgeBlendBuilder1->SetPatchComplexGeometryAreas(true);7 N# v/ s; E; h" k
; y+ p1 O2 w- B. f& P3 B
& d6 e) x6 W, X& v edgeBlendBuilder1->SetLimitFailingAreas(true);5 j6 h1 X: V9 {; a6 H6 Z
+ d3 z2 z" f! O `8 P. {* ?7 `
5 D4 V8 ^! Z8 v0 _. a% s* t
edgeBlendBuilder1->SetConvexConcaveY(false);
& L8 Y- {& C, m A/ d6 P8 M# s9 T2 V2 w E
' h0 {+ [9 z' `7 S& _* N4 r" Y3 W edgeBlendBuilder1->SetRollOverSmoothEdge(true);
/ O- b: {: `6 y8 Y! ]4 o2 h7 q% w z- o; y0 L( z! q+ _% |% [
2 o, d6 l) q: j
edgeBlendBuilder1->SetRollOntoEdge(true);1 u* y! J' \( `: M. O0 A0 S
L- ^0 c6 G+ C# \( p( Y3 `1 W% i* s; z, [* I* C
edgeBlendBuilder1->SetMoveSharpEdge(true);
% v/ Z. i2 T% g" W
. f7 t4 w1 A5 V, x$ Q6 ~- {$ P8 ]& C! t- d: z3 o
edgeBlendBuilder1->SetTrimmingOption(false);/ m! ?7 \: t) s/ ?/ N8 \
$ p& D/ G* m; {; S' s9 N" n. }2 A5 h: }9 U3 k, s2 v
edgeBlendBuilder1->SetOverlapOption(Features::EdgeBlendBuilder::OverlapAnyConvexityRollOver);
" o0 t# f, o7 \* } q* w# C V/ R7 S' l# D* ]; z
: U! D2 Y: `$ J0 f% K edgeBlendBuilder1->SetBlendOrder(Features::EdgeBlendBuilder::OrderOfBlendingConvexFirst);
$ J7 S& z& T7 z9 T. [
. |* [' }2 ^. ^1 {6 H3 p. t, Y' W# ~% E8 P1 D. _
edgeBlendBuilder1->SetSetbackOption(Features::EdgeBlendBuilder::SetbackSeparateFromCorner);
" H2 }# x" \+ o" V
u& C5 `# F$ @3 W0 x! J9 v5 N; J; i+ \6 _8 e
int csIndex1;0 n& _, N% \8 n1 U7 E, M. c! l
csIndex1 = edgeBlendBuilder1->AddChainset(scCollector1, DIA.str());5 o8 [6 W; U! L" A& P4 v
1 D5 R* t& L6 X3 j- k
6 `0 y* \; P1 ` Features::Feature *feature1; [& D1 F) Y Q& P1 _
feature1 = edgeBlendBuilder1->CommitFeature();
5 M5 _# V1 @: D& X" E _2 m/ M! m4 |! f" F3 j+ `
) L! U: N# C! Y1 Q edgeBlendBuilder1->Destroy();( z+ r! D8 o8 a/ L! f$ A8 i
( L/ a1 |. c, { }
' Y6 c6 d0 j+ z" G5 ]+ X, z2 ~ catch(exception& ex)& y* N; @; L v0 K- R
{
6 s0 i E) Q2 t2 D9 @ //---- Enter your exception handling code here -----! h! Q5 Q: g0 j4 x/ A
errorCode = 1;
: t! ~0 L- R9 l$ m" Q, ^, b0 H selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());$ P: T% K- X7 y' z
}$ W+ Z, }# F8 h6 q4 C
return errorCode;/ U0 n4 d) u' v9 Y4 M
}
1 Y$ ]; H6 C; O# |. n4 v# I% `3 }' H7 y. g# \
说明:因为字数有限制,这里只贴出关键代码。: j1 b9 @7 Z* \4 `( f d b7 g' t
, s ], k5 [4 k! y1 H; D# y
6 z5 m$ V# n5 A* k, N% c
9 a/ o* K, f! H3 B- P1 I; [ |
-
评分
-
查看全部评分
|