|
|
秋爱
发表于 2015-8-15 09:15:43
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
7 n$ e! H T; ^5 R& I
void selectedge::initialize_cb()- A! d0 p" k; {- b2 o0 d) k
{% W: S% D' B+ f% R# H, Z
try" x: C' }6 w- p! _: K& ]6 O1 Y
{
. i8 I& B, u! H$ f, t group1 = dynamic_cast<NXOpen::BlockStyler::Group*>(theDialog->TopBlock()->FindBlock("group1"));/ n) d1 T7 t1 @! `/ m
edge_select0 = dynamic_cast<NXOpen::BlockStyler::CurveCollector*>(theDialog->TopBlock()- >FindBlock("edge_select0"));
+ k. S* M" z r% t& U expression0 = dynamic_cast<NXOpen::BlockStyler::ExpressionBlock*>(theDialog->TopBlock()- >FindBlock("expression0"));}
- |6 D$ R0 H$ L9 H# s6 A/ o caTCh(exception& ex)" ~* O3 ^! k! j5 M/ g
{
6 }" Z: P4 y: ^$ l0 o //---- Enter your exception handling code here -----
6 D3 a! j' w8 w) P$ v selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:dialogTypeError, ex.what());
' u! v0 i3 L# F- Y; r }" m- }1 ~' i$ a# w# F4 [ P1 z3 t7 g. m
}1 g: x. O3 P; ^2 K# R+ I2 Z
; P% J# Y; y/ F' }int selectedge::apply_cb()
, `3 y2 d" ^ v0 |{
4 i9 u+ d* I8 x' o1 ^ int errorCode = 0;1 X8 o( f( J$ F4 o$ V
try: \# q9 m3 G* f# X& M: p- [% v
{5 a- r) C6 Y+ _0 k, w9 ~. k' n2 ]2 R
//---- Enter your callback code here -----
6 a2 [ S0 f3 I3 y( p R
) g; |' s' e- n
" m" D j& R+ i4 T7 i/ U, W7 l( K# } \& e
Session *theSession = Session::GetSession();4 ]7 q9 N2 X" W
Part *workPart(theSession->Parts()->Work()); Z$ J+ m& z& d
Part *displayPart(theSession->Parts()->Display());
% v+ t1 E. a: [, e8 \
) u- c( l0 L6 V, l% \( d' P; g2 ^- p) Q
Features::Feature *nullFeatures_Feature(NULL);7 w! v. e2 V' y4 N# f$ k
Features::EdgeBlendBuilder *edgeBlendBuilder1;- O" R1 v0 }- u4 n2 w$ s( o
edgeBlendBuilder1 = workPart->Features()->CreateEdgeBlendBuilder(nullFeatures_Feature);
5 y0 K+ V* h+ w' q% y& `3 ? Z
) i3 K4 i5 ?9 G1 f% q* D+ x( q& G; i* I6 U/ ]
ScCollector *scCollector1;1 U( k( J! u/ H- I, o
scCollector1 = workPart->ScCollectors()->CreateCollector();8 }9 l! O+ c) }# }; ?0 N
! o! P! z3 b+ @; k
7 b8 P. y5 j6 Z! i8 U6 x' r std::vector<Edge *> seedEdges;
6 Y% D- B6 `6 v
, N9 `; e" V* _ std::vector<TaggedObject*>selectob = edge_select0->GetSelectedObjects(); //获取选择的对象# Q3 `& o$ Y& B: y1 e& V0 a
for (int i=0;i<selectob.size();i++)( F+ k( @( p! |+ T6 T1 R2 Z3 m: \" K
{4 E, k( k. J1 f+ j$ \) a7 p! n$ h2 c
seedEdges.push_back(dynamic_cast<Edge*>(selectob));+ n4 a+ p* c# o: D* Q% W
}
; @& \2 _ e) `6 s0 Z; b; i- W- H* M1 Z$ B ~: I* Z
double dia = expression0->Value(); //获取表达式的值- ]2 o$ x i- R& x1 r
stringstream DIA;' P, j' a- F/ O# Z2 Q1 e
DIA << dia;' @# _1 N! E, N' S3 e( E
# A& H. N; z* Q; e
/ {; d, x9 t; v* [, j EdgeMultipleSeedTangentRule *edgeMultipleSeedTangentRule1;5 Q8 N; n) w% h4 ^% G/ Q; T
edgeMultipleSeedTangentRule1 = workPart->ScRuleFactory()->CreateRuleEdgeMultipleSeedTangent(seedEdges, 0.05, true);3 v/ W1 J2 }/ i t3 j
4 G2 I0 x% h% ~) O4 I+ ^ p( @& g) D) R, p
std::vector<SelectionIntentRule *> rules1(1);+ F, w0 L- e5 w% Y$ P) ^
rules1[0] = edgeMultipleSeedTangentRule1;
$ _; Q6 @+ o4 H: _+ [' K4 g. Z+ X scCollector1->ReplaceRules(rules1, false);/ t+ v5 `; C% x/ v
. o6 G$ v$ n; `2 K, I' U
9 z3 \4 f: e3 `+ l$ a' A edgeBlendBuilder1->SetTolerance(0.001);1 n! O, C. ]0 C3 d( c! P
& M& s0 A- r+ J% A
' p' ]& Y& w: V4 j0 c edgeBlendBuilder1->SetAllInstancesOption(false);
1 h1 G( C( i; v2 I0 m; h% a, R/ @3 ?- Y. n9 ~" {
, T- k1 k! u8 ~: |
edgeBlendBuilder1->SetRemoveSelfIntersection(true);
, J, [* [2 q' R
( y, B- V j; h7 E% y# |6 g' x( ^3 M9 i; V+ ?; F
edgeBlendBuilder1->SetPatchComplexGeometryAreas(true);$ h' C& T7 G& E. q+ }
9 c! v; r4 V9 s; {4 V1 y b
$ }8 t2 M' P9 c$ v+ [* l1 J edgeBlendBuilder1->SetLimitFailingAreas(true);: v* o N! Z& P2 n
+ y S7 i6 ]+ y0 b" U
' @! J7 Y x- ~2 k% Z
edgeBlendBuilder1->SetConvexConcaveY(false);0 ~6 p5 v& M4 J" I/ j/ P: ]' n
7 g+ _& [- X# p; |' U/ ]' |" w5 Z+ L; ?* \# o% }
edgeBlendBuilder1->SetRollOverSmoothEdge(true);0 b1 x+ t9 D/ W6 [( {
! A# _+ G5 d" ~8 I9 Z% k/ b: e. {2 {
$ B4 ]" J; m* n& y edgeBlendBuilder1->SetRollOntoEdge(true);/ W# m' e* z% ^
5 {% k1 D) [7 g
: E3 d5 {0 ^, l. x1 M7 u2 Z6 @; b edgeBlendBuilder1->SetMoveSharpEdge(true);1 n; N7 l5 L b
( {3 j5 k Q( u! i
3 S- H" S2 k# _% J2 K( A; s edgeBlendBuilder1->SetTrimmingOption(false);6 M9 m i' ?& M/ g
2 t M/ y1 X* M: ^
3 S( v% h1 q1 L) O edgeBlendBuilder1->SetOverlapOption(Features::EdgeBlendBuilder::OverlapAnyConvexityRollOver);
- I3 i0 l1 |5 C+ [, E2 E, z9 A/ V& h2 n- R
3 H3 r6 H' y1 {$ P X1 z4 f edgeBlendBuilder1->SetBlendOrder(Features::EdgeBlendBuilder::OrderOfBlendingConvexFirst);7 c- b9 s4 i- ?% f5 o
8 n) M( D+ y) h
' i9 { z- h* r: X+ ~ M; l
edgeBlendBuilder1->SetSetbackOption(Features::EdgeBlendBuilder::SetbackSeparateFromCorner);8 A. o$ P3 ?4 P$ Q( K
% N# V0 ?9 s0 f8 m& W: h. v, `& y
# g& s; w$ S3 E+ e7 A
int csIndex1;
/ j; V8 p# R' k. D6 R csIndex1 = edgeBlendBuilder1->AddChainset(scCollector1, DIA.str());
9 q& ]# S' {' s. O* j+ A) K) |+ G8 q9 L& \/ ?0 r8 e
& I( N3 Q0 A h' D: ?
Features::Feature *feature1;
6 ~/ y% ^; j5 Z7 n feature1 = edgeBlendBuilder1->CommitFeature();
* V% C/ v( q9 r. J1 [* m7 f, R- c3 @3 t
" c* L; n2 z, d, W9 {3 n) J
edgeBlendBuilder1->Destroy();
; D6 d/ T) b3 L* y6 s O/ |/ n5 F9 R; D# t- j$ ?) r3 F3 @
}
+ R# Z7 A/ E6 B3 w, E catch(exception& ex)
5 I g$ ~: e; E3 n" U) t; S {* [ u* m. K7 z) { W
//---- Enter your exception handling code here -----0 N5 [" c) u4 f+ X, F5 u- b# a
errorCode = 1;, j* k5 ~+ Y6 V# q* k4 a4 A
selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());! N8 T5 [9 w G
}
6 I6 o/ K5 j$ a9 Y3 M return errorCode;; e+ [( F$ n/ I
}
$ }) ~/ K& k2 U, d2 }2 \
4 J" A5 u2 R/ X$ o q5 h说明:因为字数有限制,这里只贴出关键代码。( J1 J5 M3 ^# d
0 |# F! R$ b8 u- E
6 a8 [7 z' v; d' p
1 @7 S: h; k- v) y
|
-
评分
-
查看全部评分
|