|
秋爱
发表于 2015-8-15 09:15:43
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
5 `2 b& k' \9 x/ d$ }+ H
void selectedge::initialize_cb()
7 D* v# O( h/ f6 ]" ^7 ]+ f, t" C" M3 r{
4 t* @, i) ^/ d! Q6 ]/ g try- S0 X( M4 r* S7 O
{/ V e. w& R# C, ]6 x
group1 = dynamic_cast<NXOpen::BlockStyler::Group*>(theDialog->TopBlock()->FindBlock("group1"));& E- ?* b0 p# w+ K
edge_select0 = dynamic_cast<NXOpen::BlockStyler::CurveCollector*>(theDialog->TopBlock()- >FindBlock("edge_select0"));
3 z7 y# l$ e) R K7 k. x expression0 = dynamic_cast<NXOpen::BlockStyler::ExpressionBlock*>(theDialog->TopBlock()- >FindBlock("expression0"));}/ d7 b2 J- a$ e
caTCh(exception& ex)7 r. j6 ]3 O* f1 ?( H1 a
{
, S+ `3 |, A: K! Z //---- Enter your exception handling code here -----1 z2 d9 U; I4 D
selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:dialogTypeError, ex.what());
0 k+ d! ~6 h, y }8 m- p8 c% {2 c( p
}9 }" N2 d6 f4 N
! J# h9 |: D9 P; xint selectedge::apply_cb()
/ o3 h* }* x1 m! g{% {- A% b& k4 Y9 q$ l- E4 X5 P
int errorCode = 0;4 _" E/ v$ J. ], ]; @/ v
try5 t6 A) ~2 `7 J% Q: W
{! Y) Z! z$ S: b
//---- Enter your callback code here -----3 X- G$ r/ o5 l
1 V: {& Q. D( N4 f0 _& G
3 u* g9 T5 e! C0 K5 [0 Z$ I3 U, L; O- A# e% D
Session *theSession = Session::GetSession();$ C4 a9 j& s; ~ S6 t
Part *workPart(theSession->Parts()->Work());
' _, E) \ v7 ~# g+ t" a Part *displayPart(theSession->Parts()->Display());9 _% @ U3 a; d" |. U6 p' l
% n: j6 `1 {: Q+ @; z" y4 _4 W5 V4 V* G4 }# I0 S& x
Features::Feature *nullFeatures_Feature(NULL);
1 [3 ~6 E* B7 w' e Features::EdgeBlendBuilder *edgeBlendBuilder1;
+ e# \6 l! v0 n9 }/ V, _4 {( S edgeBlendBuilder1 = workPart->Features()->CreateEdgeBlendBuilder(nullFeatures_Feature);
2 n p' P/ Z# S# x/ U, D# ]
/ J* o! K' H; ^
+ P0 ] V. f8 C! S, N1 N6 e' X# S ScCollector *scCollector1;
: @$ S) Y' j) {/ g$ r4 A" d scCollector1 = workPart->ScCollectors()->CreateCollector();+ r8 Y* _, I& v/ b, `" p ?
! i" j* j7 F5 j9 F5 v# k7 F2 H
F$ n; G# U. k- `; u4 H" R- m
std::vector<Edge *> seedEdges;) ?) F- `5 K+ a2 F) t8 X& q9 H
: v- y# M* l3 a/ H# A
std::vector<TaggedObject*>selectob = edge_select0->GetSelectedObjects(); //获取选择的对象
: d- F1 B: q6 B2 T3 O: L for (int i=0;i<selectob.size();i++)
) ?. B: P2 @" I- L g {* V0 B5 K$ @# A. ~' ]0 R. h4 x
seedEdges.push_back(dynamic_cast<Edge*>(selectob));$ e2 L Y1 d$ x& @5 }, n
}
" P% n5 a' a! E9 {" p: K0 X
, X* x0 O* }6 D0 m: F- ^ double dia = expression0->Value(); //获取表达式的值
8 V* {" |7 O" @" w3 W* @$ V$ y stringstream DIA;
2 E( _% E" C& r0 Y$ E# h" r' H DIA << dia;' z- ^, |0 |6 H7 w7 y6 ~. v" r
/ y. F" Y R& u$ ?! x
, z6 o* V1 p0 d EdgeMultipleSeedTangentRule *edgeMultipleSeedTangentRule1;: M8 {5 y) ^* s; g/ r
edgeMultipleSeedTangentRule1 = workPart->ScRuleFactory()->CreateRuleEdgeMultipleSeedTangent(seedEdges, 0.05, true);, y( W5 b$ {: J
6 W- A* I* ^/ y! Q& g! D/ P. Y" C( p6 a
std::vector<SelectionIntentRule *> rules1(1);/ y) W" G: t" o1 |0 M
rules1[0] = edgeMultipleSeedTangentRule1;% {! n# O: }* ]: {& H7 g, v
scCollector1->ReplaceRules(rules1, false);* E6 y. c& X+ o/ r7 E
- d6 c" @3 l9 P( ~1 I4 O4 p8 g0 x
" G% l" }2 {$ U
edgeBlendBuilder1->SetTolerance(0.001);' f0 q# n3 G- B# w7 @3 q
4 Q( M6 d3 ~5 U" h, m9 [8 H, m( j, H
9 j* b% w1 T4 F/ y P edgeBlendBuilder1->SetAllInstancesOption(false);
# `# @9 }5 Q7 y8 t2 i5 N# W' N" o2 V! Q! t# ~2 s+ E
) w) m4 Y/ }% K; l8 v& R edgeBlendBuilder1->SetRemoveSelfIntersection(true);8 N- ^3 k! |/ w1 Z. z3 `
& F1 O5 L8 r6 m
]$ t" }( |1 X/ A' x/ N# O* l8 r
edgeBlendBuilder1->SetPatchComplexGeometryAreas(true);
5 C& P O- k2 O, R! h* P4 e; I$ ~/ [2 d5 X+ {
$ `# l; t, i$ {7 }* J. L7 z edgeBlendBuilder1->SetLimitFailingAreas(true);
; l" @/ U5 ^8 ^$ l8 l3 |. F4 W; D
1 Q I* d, _/ V8 |( U0 r ]7 Z6 p1 z+ f; z" p4 {9 p# w
edgeBlendBuilder1->SetConvexConcaveY(false);4 j- D% }- U9 A; A S
/ X0 n- E6 I9 e- ^% o$ G
# `! |/ Z9 m- A! r edgeBlendBuilder1->SetRollOverSmoothEdge(true);
9 v/ D1 x7 P0 q
9 N+ F/ o! U+ t6 j6 `
2 A2 O7 z4 O. i) r edgeBlendBuilder1->SetRollOntoEdge(true);
" e: X+ b! t0 |' q; E
G$ ] \$ {, w) G2 f
$ p3 K9 L7 l2 ?+ f* }0 t edgeBlendBuilder1->SetMoveSharpEdge(true);/ N0 h: X3 n: s3 t
/ C ^' ^! G) O, ^
- f3 c# w4 A0 T' H$ d2 S3 x$ K edgeBlendBuilder1->SetTrimmingOption(false);
; I1 [( p7 p% s5 S$ S0 }7 ?# x* t! B, C- g, L
0 I% d! w# y$ a3 x+ J
edgeBlendBuilder1->SetOverlapOption(Features::EdgeBlendBuilder::OverlapAnyConvexityRollOver);& s8 r$ J9 ?9 @- ]/ L d
. z, [$ N4 E) @( |
$ O" G8 H$ D# Z& D: E |
edgeBlendBuilder1->SetBlendOrder(Features::EdgeBlendBuilder::OrderOfBlendingConvexFirst);
1 l) E8 U' _" v: q, J
7 l Z1 a1 @ i9 @( |+ G8 \& N/ q9 C; o8 }9 l: J5 k9 w3 D
edgeBlendBuilder1->SetSetbackOption(Features::EdgeBlendBuilder::SetbackSeparateFromCorner);
6 X4 [ j+ }: [8 N- X2 ~
! P+ O8 c }0 b) W2 Q" i+ g1 {. a: O- J0 L5 @+ U
int csIndex1;
0 Y x! k) h/ ?4 }( I csIndex1 = edgeBlendBuilder1->AddChainset(scCollector1, DIA.str());
; c& t( i& c$ }2 C/ i. ]6 J* I$ g/ j
0 Z8 g6 d) B: A Features::Feature *feature1;- e: ]) `, ~$ D- x2 z, v$ ^* w# ~
feature1 = edgeBlendBuilder1->CommitFeature();
7 ^# d% \% ^. I. U5 C8 R W' r% `2 T" ]
4 b6 Q& H8 G% a% D edgeBlendBuilder1->Destroy();
1 e, j% Y5 L7 Y% p: `* D+ T; g5 w- d
}; ]) P8 h6 |& b, C# B( U
catch(exception& ex)
4 J5 { g8 u! r {. ]' J' X2 Z) K% l8 q
//---- Enter your exception handling code here -----
$ |8 L9 _% `) Y% U: ^6 y errorCode = 1;1 a6 T& i+ m7 _. Y* n" \- t8 I
selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());' `: S+ W" c5 Z' Y" ]) X1 R$ A
}1 C$ Q- w4 H% J, s: d
return errorCode;3 l, h3 B7 b! R B0 i/ r* y J+ c/ \
}
& a2 l" N# ?9 @- Y4 M8 y3 |0 B% O5 }: G' [% z, O; M
说明:因为字数有限制,这里只贴出关键代码。
/ D0 b4 l$ \( `7 A; N! A0 n( ^; g- O' S) c
& \) r5 M& ~+ F
1 h# c- R5 g8 _3 K& z+ h |
-
评分
-
查看全部评分
|