|
|
秋爱
发表于 2015-8-15 09:15:43
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
* Q5 U7 H% V( [4 e: D/ R2 W
void selectedge::initialize_cb()
: M& s) `; c) R5 I! |# Y. k{' k9 H. `4 A/ w) T
try. K$ m8 F1 x. [: h D& ^" Y) ~2 B' m% V
{
5 g1 P* u9 {2 U& T* H$ a. `3 }9 @ group1 = dynamic_cast<NXOpen::BlockStyler::Group*>(theDialog->TopBlock()->FindBlock("group1"));
9 c7 |+ S2 ?0 d2 n, ?0 W" ]5 H edge_select0 = dynamic_cast<NXOpen::BlockStyler::CurveCollector*>(theDialog->TopBlock()- >FindBlock("edge_select0"));
0 W- S( V+ W* J9 b% D expression0 = dynamic_cast<NXOpen::BlockStyler::ExpressionBlock*>(theDialog->TopBlock()- >FindBlock("expression0"));}
+ I% x8 Q X, O6 G; [; w u# S2 t caTCh(exception& ex): N9 f; k0 D3 o. P \
{3 G" ~) W& I5 v
//---- Enter your exception handling code here -----
" ?. V( E- l1 i) r. c2 h selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:dialogTypeError, ex.what());
7 B) d* J& _9 O. \# F }9 d; f4 a4 Y8 G: F
}; `- ~ o/ v) K* ?2 b
8 i" r1 R; d! g
int selectedge::apply_cb()
4 W0 g: M* Z! o5 l! y, Q2 e4 w) h& E{9 L- a0 C# L) v& H, N9 |
int errorCode = 0;2 R4 e6 F" N" g# s
try
2 K6 {& v. y- o. n {
# d% ~1 u& f2 t4 } //---- Enter your callback code here -----
b/ O& a0 P' ?( v x
4 h x1 }% s' J. l0 C) u) K v9 [8 ]# p6 `$ s$ U
! y! ^% Y* `6 _( B0 n Session *theSession = Session::GetSession();. d/ b4 h: y7 c7 B
Part *workPart(theSession->Parts()->Work());
2 {4 J0 _3 {2 o% x7 @& C; o Part *displayPart(theSession->Parts()->Display());0 h0 t ^0 ]' D" M- G& y
) W+ S9 j; ^4 W- E" I$ G& \/ F9 O6 K2 t c4 X# a- e
Features::Feature *nullFeatures_Feature(NULL);
& I* t- ?9 {8 v! X0 d Features::EdgeBlendBuilder *edgeBlendBuilder1;7 p, M: s+ j5 X) n4 ]) ~2 P
edgeBlendBuilder1 = workPart->Features()->CreateEdgeBlendBuilder(nullFeatures_Feature);: L" y, f M F, R
5 L/ s; \- j/ a! i0 J4 x: `( r
) s1 s, N- m6 q
ScCollector *scCollector1;/ @5 g7 ? J$ I, C
scCollector1 = workPart->ScCollectors()->CreateCollector();
4 @) n E4 K1 F. d4 }
$ v- ]+ Q8 w8 R/ q7 q0 `0 h/ Y4 @+ A3 l8 L/ V' q- p4 _7 E
std::vector<Edge *> seedEdges;
4 v1 l0 V) h; b$ c+ s6 a- p" O
" C: `' i# t6 {! p* P std::vector<TaggedObject*>selectob = edge_select0->GetSelectedObjects(); //获取选择的对象( S" W( S E# |* f) N. _1 D
for (int i=0;i<selectob.size();i++)
% y/ N% \8 z- s! M4 l# i* u {
# x+ U1 Q9 H' I% i seedEdges.push_back(dynamic_cast<Edge*>(selectob));
; p# E8 j0 `0 x3 _ }
% O3 Y% f% X2 E# F8 K
9 Q% T9 |1 Q. \ double dia = expression0->Value(); //获取表达式的值- e8 [& }5 \$ t* h( r4 F7 E
stringstream DIA;7 T o/ l/ g% E
DIA << dia;. ^" f: T7 ^3 r* D2 o% [, `7 x
0 F* N; @5 V: n* [) J' A w
- ]4 I% ]" |0 C( A EdgeMultipleSeedTangentRule *edgeMultipleSeedTangentRule1;
/ \7 l8 b. \" R& n6 ]* G0 R edgeMultipleSeedTangentRule1 = workPart->ScRuleFactory()->CreateRuleEdgeMultipleSeedTangent(seedEdges, 0.05, true);
6 {- {9 V. C5 k0 L: A
. P, I: S; }) L; c1 f# w% j* ]& s( y1 O. G. ]/ L
std::vector<SelectionIntentRule *> rules1(1);
: d- o" _/ R4 z$ Z7 E4 F rules1[0] = edgeMultipleSeedTangentRule1;
1 B( k; c; |& K9 B scCollector1->ReplaceRules(rules1, false);0 P. `4 Q8 P1 N* h, |3 V3 F
5 {% t+ N- p, w
' p n; r. l3 U* B: z edgeBlendBuilder1->SetTolerance(0.001);
0 K) a4 I$ \4 g2 [9 r! \' O. n: f; n+ }3 m7 C! o5 c
) _8 N a" h2 r# i8 t2 U
edgeBlendBuilder1->SetAllInstancesOption(false);
: s# F; E* ?2 P0 z9 S4 ]/ j4 n' h7 F2 p, S* V2 N2 s( V8 P
# Q2 [. I0 Y( O0 Z
edgeBlendBuilder1->SetRemoveSelfIntersection(true);
3 k* _5 t/ }3 K( X; W2 b1 V
) \6 e; B& D' x" w
2 j! X* ~. _) @' N edgeBlendBuilder1->SetPatchComplexGeometryAreas(true);
, P& g3 V- U; i! g) R+ Z
* A1 `2 g2 m8 F) X5 Y- Z J
i! @4 E; c% Q! F% d2 E; q edgeBlendBuilder1->SetLimitFailingAreas(true);2 N( T' p8 s( h
' d' L: j, t% A. c! L1 `) o* ?& ?
edgeBlendBuilder1->SetConvexConcaveY(false);
- A9 V2 W M3 ^
, p+ p- |; z$ A( b; @9 d6 ^8 e
7 g( O* h) C2 ] edgeBlendBuilder1->SetRollOverSmoothEdge(true);
3 s! o1 @. K: [& k0 p$ e2 v3 S" V8 Q+ w) u" {5 S* T2 `
?8 `# C* F7 m4 N3 q edgeBlendBuilder1->SetRollOntoEdge(true);
/ F6 w0 e6 N; s
/ |7 X* `( u$ a/ c3 x- z8 H8 C0 C- ]2 G9 C5 L/ |
edgeBlendBuilder1->SetMoveSharpEdge(true);2 w0 _/ ]) a4 ?9 L3 A3 S5 z
3 ?! ]7 [! i' C0 Y1 M: E% k4 d
* b3 c- [7 P* i- P/ ^( S, ~* l
edgeBlendBuilder1->SetTrimmingOption(false);
7 V4 Q0 W! o( N& Z; W. T8 q/ ]% l6 p' T4 }, _
. `' @& u% V' u) u$ z edgeBlendBuilder1->SetOverlapOption(Features::EdgeBlendBuilder::OverlapAnyConvexityRollOver);. ^( M& M+ f4 e% \2 ~9 D
2 B T# d; m5 s' J- e9 S
" |7 h: V$ n8 d edgeBlendBuilder1->SetBlendOrder(Features::EdgeBlendBuilder::OrderOfBlendingConvexFirst);
. c* H, {5 d( I& F0 F u$ b* I
% W$ L9 d1 J8 n8 V
' U8 K# h$ `7 {! a edgeBlendBuilder1->SetSetbackOption(Features::EdgeBlendBuilder::SetbackSeparateFromCorner);
5 `: U/ U) d4 N/ N% Q
x3 Y6 t; O2 W3 Z$ e; \% Z% W' F2 S% |' f* W
int csIndex1;1 J* }! R' z# m {0 Y l5 X
csIndex1 = edgeBlendBuilder1->AddChainset(scCollector1, DIA.str());' c6 y6 @: }: O
' Z6 K5 _$ V5 o2 U, y! J
g8 T- k2 }0 c' |" Q! s6 p Features::Feature *feature1;
( o- J; y6 t+ r5 D0 }8 V3 C feature1 = edgeBlendBuilder1->CommitFeature();, r. H O& c) h5 Z0 _) D
$ c! G# ?' r5 t# G) p
* p! U: D2 a7 n, X; W edgeBlendBuilder1->Destroy();
) R- R* R+ [) ?" V* y8 F& R
. r& o! k% B- u& `4 ^ }
& j4 F D: k6 P6 {- i3 C catch(exception& ex)2 F! f: r! S L) c9 _9 n
{
0 Y1 C* ~5 g8 i6 O) y- V" g9 m //---- Enter your exception handling code here -----5 f! q. l7 Q+ G" R
errorCode = 1;8 s r+ p9 w2 A$ ?1 |
selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());6 w5 M Y2 I& k* Q9 L- u4 ~
}, N! [/ g" R$ l1 ]/ U8 z$ A
return errorCode;
0 _: j2 B, I/ ]. l4 w}
) t9 j8 A- t1 C* c6 R. c; ?( b$ ]* e2 w3 Q1 n( \
说明:因为字数有限制,这里只贴出关键代码。3 ~7 b* O% Y8 r; o/ ?# d
7 I! C x3 z4 |. V* A( `. V: W
6 l$ U; X2 }" ~/ E; p
$ J2 _. \9 O: s. U |
-
评分
-
查看全部评分
|