|
秋爱
发表于 2015-8-15 09:15:43
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
) L: G! w5 P" d' q8 M3 |& Pvoid selectedge::initialize_cb()
! V4 L% h5 s; H( T ?+ a, Z3 v{& h( ^0 W. K1 X5 d# w% y
try8 R' V. n- ]! |. v- l8 X
{/ M# R5 j% P! J. \
group1 = dynamic_cast<NXOpen::BlockStyler::Group*>(theDialog->TopBlock()->FindBlock("group1"));2 Q$ p9 I# N2 E! Q
edge_select0 = dynamic_cast<NXOpen::BlockStyler::CurveCollector*>(theDialog->TopBlock()- >FindBlock("edge_select0"));
, t3 W# W, |! C, M! V9 P expression0 = dynamic_cast<NXOpen::BlockStyler::ExpressionBlock*>(theDialog->TopBlock()- >FindBlock("expression0"));}/ N; u9 C( O R) W
caTCh(exception& ex)
\; J% x: d8 F$ h {7 a! h) @7 a- ?" \! r( F- Z
//---- Enter your exception handling code here -----
2 f' ?. Q% k/ _7 E1 t- z% v. f selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:dialogTypeError, ex.what());
3 ^; G$ E4 ?' e, x% A( l) v }
( S" ^& k) [; V, @; s8 |}
' v6 i# ]* }; |8 L. w2 o" _
. x+ K/ L, {/ u+ v3 o$ n! J$ vint selectedge::apply_cb()
* `, r! ~( Y. y{- R4 a( s- n% B: \/ i
int errorCode = 0; `0 `5 O2 _; ]7 O: A
try
( P) `: V: _, X& B) Z# U {7 r% t# d) L2 w4 F5 `
//---- Enter your callback code here -----
( a1 u8 y6 a4 B6 `5 Z+ F% I
& D* q, T+ _6 R; f
( G+ x, M- U, | J( L3 u
: [4 \4 X1 O+ j% P( u6 y Session *theSession = Session::GetSession();8 `. l( O$ z4 X1 S
Part *workPart(theSession->Parts()->Work());# N1 Z8 ~ [+ [( U9 N
Part *displayPart(theSession->Parts()->Display());
. a; q% x& D) x/ Q
8 w+ v" H% M- U% J/ \
) ?5 s+ p" X# `/ A2 {3 G Features::Feature *nullFeatures_Feature(NULL);
7 w8 w- n" }8 k Features::EdgeBlendBuilder *edgeBlendBuilder1; C1 ^& v) d/ A* u
edgeBlendBuilder1 = workPart->Features()->CreateEdgeBlendBuilder(nullFeatures_Feature);6 a! X) o# ], g2 A8 J8 c% | I5 W
! m L% W, S1 K. Z
9 K4 Y! V+ E" O ScCollector *scCollector1;
% e& A+ v9 W& n; L2 {* A scCollector1 = workPart->ScCollectors()->CreateCollector();- s5 ?: I5 N2 ]7 D8 u
. P# R! e! k+ Q' E1 S1 M6 _2 Y7 [! d
std::vector<Edge *> seedEdges;
* c4 o7 F( O+ M
9 F& J0 U; ?0 l4 `/ w std::vector<TaggedObject*>selectob = edge_select0->GetSelectedObjects(); //获取选择的对象+ q( A2 t! u0 D# R
for (int i=0;i<selectob.size();i++)# g' \5 n- K2 F. O1 t! W% ]/ I
{
! A/ B( r. `% P+ p seedEdges.push_back(dynamic_cast<Edge*>(selectob));
$ b5 ~* I2 v- V: s- G }
* x8 x4 k8 ?; G# t9 A6 [9 S- B9 K; p. Z
double dia = expression0->Value(); //获取表达式的值
7 c5 e4 v' Q- c+ N- [ stringstream DIA;- I: `+ a8 W. m# U
DIA << dia;% P2 j4 U `+ `0 R: j( ~1 {6 y3 p
- v5 a6 |5 d$ j" J/ X, J# }& {
, V: d( l# W. ~% u& _1 c* H EdgeMultipleSeedTangentRule *edgeMultipleSeedTangentRule1;7 X. x; o g8 P
edgeMultipleSeedTangentRule1 = workPart->ScRuleFactory()->CreateRuleEdgeMultipleSeedTangent(seedEdges, 0.05, true);. l: x. x) D+ @- H, J" t* b
* p: S5 W. p& [+ C3 B( \* l
3 f" K* R: d5 a/ r std::vector<SelectionIntentRule *> rules1(1);
6 Q, b; X6 H: ?- Y rules1[0] = edgeMultipleSeedTangentRule1;
4 k) `" q( D' b, Q scCollector1->ReplaceRules(rules1, false);
% C% a; Q; x2 m5 l/ ]. ^! t7 O0 y6 W: H) q' n2 N8 R: y
' Y6 n7 n3 T; \" p) y. T edgeBlendBuilder1->SetTolerance(0.001);
: _3 [$ o1 [8 Z# c Q0 d) X0 [# w7 _
2 Z0 E5 q; m$ g+ k+ ]9 k
edgeBlendBuilder1->SetAllInstancesOption(false);
$ U; l/ c# j) S& ?# d2 K4 \& J; F# z z- D% @. ~- p; q2 L# k
; F& v h3 i( a4 Z
edgeBlendBuilder1->SetRemoveSelfIntersection(true);2 [) U" ~0 o) j4 X- p
: _& X: A4 [4 }! M
( g" n9 [6 J! P2 C5 x" f6 V edgeBlendBuilder1->SetPatchComplexGeometryAreas(true);) J4 T) I6 {# Y& h) [
! t2 e- G# \- r. L# P" O- D1 O
3 _* v; ^5 w i( H
edgeBlendBuilder1->SetLimitFailingAreas(true);% s0 @7 A2 a) J4 T4 H
! i, V8 C+ ^; }1 B0 B2 S* d# u7 q6 v1 E
edgeBlendBuilder1->SetConvexConcaveY(false);- o; \) G, H) d y3 k
: F4 d# J3 y; i/ Y6 t5 m; Q
# e8 z+ c, L- m6 B4 G edgeBlendBuilder1->SetRollOverSmoothEdge(true);7 R1 S9 S" R& C
' \; D, G2 E" u% r7 i0 r" N+ v+ `( U) I F+ _& N- x
edgeBlendBuilder1->SetRollOntoEdge(true);
$ e t8 X5 `% B0 f0 D
5 X- {! M$ V" [: O* Z
6 E9 K2 Q5 i! q* J9 P( J edgeBlendBuilder1->SetMoveSharpEdge(true);* m/ ]2 w$ z f
! P: y9 `* j/ M+ A9 P0 G
; p( o$ D% d. y4 t* S edgeBlendBuilder1->SetTrimmingOption(false);
9 }! B2 K) R7 c* C) B* B
+ y1 G/ T; z/ l0 U! d# j4 m7 b% A* _1 M' J4 {, D% i2 V
edgeBlendBuilder1->SetOverlapOption(Features::EdgeBlendBuilder::OverlapAnyConvexityRollOver);
9 s; J; `4 T( h7 k/ [# G0 O2 I
' I* q3 ~' K6 t5 N. s9 a3 e, z edgeBlendBuilder1->SetBlendOrder(Features::EdgeBlendBuilder::OrderOfBlendingConvexFirst);' F7 u2 n; X0 v9 w7 p
0 R2 q! N0 G1 U: p% C5 W, ? \- X9 w" e
edgeBlendBuilder1->SetSetbackOption(Features::EdgeBlendBuilder::SetbackSeparateFromCorner);
: ?* H% k) t3 U: ^, p% z( |5 p O$ u+ l3 _
4 W9 n' T: f! T: K0 b0 Z4 J2 x8 k int csIndex1;
& [! W9 S. I- q- ~/ J" j csIndex1 = edgeBlendBuilder1->AddChainset(scCollector1, DIA.str());
$ w$ d" v' K5 k) ^/ U9 Y( @! {6 {2 l" _ }& z
& A5 j0 d& W/ x' O( i
Features::Feature *feature1;
8 R# k3 ^* k2 R' F& b7 n feature1 = edgeBlendBuilder1->CommitFeature();. G; r- `/ U9 }" b- t, _
$ D c U" s+ V8 f$ u+ R2 p' m& \$ _8 K9 B- E0 l2 p s/ s
edgeBlendBuilder1->Destroy();" a5 E- o% J) A) V5 {5 o$ e
6 _& }: I5 C& G. c8 E- I' ] }
6 f' e) V4 Q+ C9 a# O catch(exception& ex)% s- H# g' T: g4 [
{
# K. n8 `% ?4 p* J b8 J //---- Enter your exception handling code here -----
8 I: U5 I- |5 L; |# X# K* v errorCode = 1;
+ Y+ X; p$ K8 e4 P( Z+ K8 |6 k selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());9 o( r+ m8 e. b' B; G# I1 {
}
5 ^; I" x9 L8 K" u8 L) [1 }# c return errorCode;6 `% q! d/ g: d2 V& r4 t
}$ I5 Y& |$ G, S' h3 L
/ `7 W2 X6 K G3 Y
说明:因为字数有限制,这里只贴出关键代码。7 P2 ]& H, x+ e d# S
$ S9 B) r. S$ s0 `" O& M% W' P. {3 a3 B" ?+ W! K+ X
% O& H$ \# }& ]' N$ a" I( B& R6 u, T |
-
评分
-
查看全部评分
|