|
|
秋爱
发表于 2015-8-15 09:15:43
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
+ x/ W' i0 H; s) I3 m3 pvoid selectedge::initialize_cb()
3 g) d6 I1 _+ I3 x" W4 A; W/ t{6 @+ N5 Z; a. F# m. u7 }
try" y5 Y" p) T! e) f
{
) f: V" l2 X% F group1 = dynamic_cast<NXOpen::BlockStyler::Group*>(theDialog->TopBlock()->FindBlock("group1"));0 R* f. A3 n+ r" {) ~0 V
edge_select0 = dynamic_cast<NXOpen::BlockStyler::CurveCollector*>(theDialog->TopBlock()- >FindBlock("edge_select0"));
9 E6 F6 O' v& n @! I7 r expression0 = dynamic_cast<NXOpen::BlockStyler::ExpressionBlock*>(theDialog->TopBlock()- >FindBlock("expression0"));}
M6 _7 Q: a( a5 p: ]/ q caTCh(exception& ex)6 C) @# T9 Z+ k) g* J$ U% d
{
1 `5 ?3 F# c# D //---- Enter your exception handling code here -----
3 K$ G3 M1 H, z6 C S+ a" Z. v7 t selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:dialogTypeError, ex.what()); L/ H" k6 g6 B9 |
}
T9 E- w2 P7 K) f" M, f# E}
- Z% Q- m8 E- [; T6 }+ E0 j( h. x& h) I, B
int selectedge::apply_cb()4 ~* J9 c% u& u2 x
{
6 ^: n2 T' _. l) f& N2 t5 N4 \ int errorCode = 0;
3 y3 N+ O: d1 t, x* Z! v try4 J8 V1 X$ o; a! {8 {
{! p! o5 S6 ~9 p# Y \ [
//---- Enter your callback code here -----
5 r4 `% [" N: L
0 W9 o( H& V2 n8 @! `
5 f9 t5 o# D% t' n m" P' u
2 {8 m5 Y( q5 k+ M1 K Session *theSession = Session::GetSession();
" j0 x3 G- P' y Part *workPart(theSession->Parts()->Work());% e7 q3 P7 ?* a+ S
Part *displayPart(theSession->Parts()->Display());
9 l: ~' Y V5 \8 ?4 {4 p8 ? u1 x$ _
2 W+ n( R9 M' J# b( A Features::Feature *nullFeatures_Feature(NULL);( _2 J( T5 ?, q" L b6 c; C& w8 W
Features::EdgeBlendBuilder *edgeBlendBuilder1;5 O' `5 B: G- L" [' {1 N
edgeBlendBuilder1 = workPart->Features()->CreateEdgeBlendBuilder(nullFeatures_Feature);
2 q1 N) n# g1 q2 l, w- L j+ q5 W: {
8 I/ i7 v- ^" n8 M4 [ ScCollector *scCollector1;
: j4 y4 B6 H# w$ ^. l3 Z2 | scCollector1 = workPart->ScCollectors()->CreateCollector();
. t' F8 j O6 }0 T
. {% ~7 d% H! w2 N# ~2 s
b8 g1 p7 G4 `0 {$ l std::vector<Edge *> seedEdges;2 o1 ?6 |. u7 h6 a+ H7 g& Y& `! e
) a* u- [( [: G
std::vector<TaggedObject*>selectob = edge_select0->GetSelectedObjects(); //获取选择的对象
1 T" d% m z% l for (int i=0;i<selectob.size();i++)
: s1 [5 w, E& x) j# X {
) ]5 u7 G5 E% y7 F& B6 i seedEdges.push_back(dynamic_cast<Edge*>(selectob));
. w. h9 b6 z+ ]) _( Y; m/ } }
8 g# j6 O |' F2 z' @, H) ?
' q; K, g% p7 S/ v; o4 ~ double dia = expression0->Value(); //获取表达式的值
6 i0 ~) \! O, @* j4 s stringstream DIA;4 x* j/ Q# ?, G# \
DIA << dia;' ]4 j! u8 k9 l/ t/ B/ j3 U0 B
, {5 T" |2 p" c+ g4 Z
9 e, g' i, n0 G EdgeMultipleSeedTangentRule *edgeMultipleSeedTangentRule1;
g! i0 E! v+ s# | edgeMultipleSeedTangentRule1 = workPart->ScRuleFactory()->CreateRuleEdgeMultipleSeedTangent(seedEdges, 0.05, true);+ T a/ h) d: J
% y8 B+ c) e9 `! D9 [5 i
6 i+ g3 c6 j8 J1 p$ h4 G std::vector<SelectionIntentRule *> rules1(1);
4 D6 n& G$ L+ o# j; Z, U8 ~3 F1 _/ b rules1[0] = edgeMultipleSeedTangentRule1;
) n) T, Q8 L& l, ^ scCollector1->ReplaceRules(rules1, false);' p6 D" B% }) r! q$ q! \5 E' [
. j h0 |. d' n6 F9 q' ?4 g* I" b2 b
7 W( ?5 ] [* N1 A; l7 Y
edgeBlendBuilder1->SetTolerance(0.001);$ O3 M. _" J' l3 p! N2 H1 c
4 R& `* |7 B4 `" \. W4 O7 G* A8 l [" I' A7 k {, }/ f
edgeBlendBuilder1->SetAllInstancesOption(false);
5 @, O } O. @5 r% o* ]8 e% `# O* @% w5 }
& @( S5 x; T3 T, c
edgeBlendBuilder1->SetRemoveSelfIntersection(true);2 W5 g5 k9 |; {) ~2 Q/ I
& j V. x0 U, g- D* O$ \- K5 I
3 p2 ?. H( V9 m/ W! b- j/ Y, X edgeBlendBuilder1->SetPatchComplexGeometryAreas(true);
" L6 l& E: [8 p6 K6 b' n
3 O* r9 _3 k: f: j$ T9 B9 }3 G v# Y7 |8 c# ?9 l" r: B2 w
edgeBlendBuilder1->SetLimitFailingAreas(true); U" q( K( X2 c, I
3 ~9 m5 U2 z Y9 A$ _- D- ~
, L7 W6 N) q+ W) P0 ]
edgeBlendBuilder1->SetConvexConcaveY(false); y: |* p! _. f7 C/ a
0 \$ `" {3 i8 Z+ ~1 r
- B$ S; \ N7 R- _ edgeBlendBuilder1->SetRollOverSmoothEdge(true);
2 B- H- p. d* Z n; x! J/ u6 s) w6 E$ @9 [7 M7 [
1 G' g) T1 V' [
edgeBlendBuilder1->SetRollOntoEdge(true);: {. |4 N2 k3 q% q5 B3 R1 j# e
; q& w1 G }! p+ Q ]* y1 r
& O. G% @! }/ v6 M: ~+ p+ I edgeBlendBuilder1->SetMoveSharpEdge(true);
B. B6 @% u+ W8 _& t% Y
. n o5 g1 h! D( z
, _; s" |( w* K1 \ edgeBlendBuilder1->SetTrimmingOption(false);) U, k$ P. u4 S
~( t6 ]7 [, v
4 g4 f! k3 r9 J/ h* I5 E
edgeBlendBuilder1->SetOverlapOption(Features::EdgeBlendBuilder::OverlapAnyConvexityRollOver);. J" ]3 k' v2 p
' {2 q8 V1 A! m R) w' f0 t- @: {( P+ h
edgeBlendBuilder1->SetBlendOrder(Features::EdgeBlendBuilder::OrderOfBlendingConvexFirst);: o; W4 v0 \5 M: z0 S7 U
3 Z' T- G# B0 E+ M0 p# G
' L, d- `. c4 }$ G2 M5 E* t edgeBlendBuilder1->SetSetbackOption(Features::EdgeBlendBuilder::SetbackSeparateFromCorner);
6 h: a9 K* U. e3 Z- p& I% z- D
- E# H* D3 p% b9 |0 | t5 ^+ j6 F1 {. \
int csIndex1;$ v4 e' n: s5 W. a* K
csIndex1 = edgeBlendBuilder1->AddChainset(scCollector1, DIA.str());0 J/ B: w. i) ]3 W- m5 X
3 A7 I3 k% r+ ~, q f- t
, D$ t G+ f: K( n% {; z8 t; c Features::Feature *feature1;2 U. y1 W4 l5 R c' b$ d
feature1 = edgeBlendBuilder1->CommitFeature();4 Q8 h/ t' S* b! G5 A
) ~+ @0 f4 f% U# Z, C) g" R: T% C, h$ M, r& w" D' V$ ?
edgeBlendBuilder1->Destroy();
z! E$ N) M9 F, Q' D% n) u0 E- c# h8 h- l2 i) ?
}2 F7 l# y, ]3 L% I+ W
catch(exception& ex)
6 G: M# F6 [6 m; k {
; i8 Z, t) e, T! V% Y$ m //---- Enter your exception handling code here -----$ L' E1 _8 p* X7 T
errorCode = 1;
1 ~+ y8 [6 [+ v4 [ selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
4 l5 P6 D A; |# L# }0 u* D, L }' K" |, Y5 }4 G$ l
return errorCode;
2 A* s2 l0 S6 |3 L: i}% e1 S9 D* z% w$ k% }) A
t: \" L V* K* |
说明:因为字数有限制,这里只贴出关键代码。
5 M( ~8 U5 W7 I: p$ Z9 s6 X2 d y4 N$ O# x
% g$ @! e# E' S6 ?' |& ?
9 M! ?" \2 E" f) S$ Y( F |
-
评分
-
查看全部评分
|