|
|
秋爱
发表于 2015-8-15 09:15:43
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
. u2 g0 F% n- ^4 }$ L
void selectedge::initialize_cb()/ I* I/ `( u6 k8 u
{- y6 @% e, l4 D4 N& p, Y0 ~
try
* L K; X9 D4 s: a5 T. e% t {
% e! ?; B2 P4 T6 `" D A group1 = dynamic_cast<NXOpen::BlockStyler::Group*>(theDialog->TopBlock()->FindBlock("group1"));+ \2 o# J ~2 O# B [/ M/ ?! F. v J
edge_select0 = dynamic_cast<NXOpen::BlockStyler::CurveCollector*>(theDialog->TopBlock()- >FindBlock("edge_select0"));; y3 T! Y8 W6 G4 h/ e& `) m
expression0 = dynamic_cast<NXOpen::BlockStyler::ExpressionBlock*>(theDialog->TopBlock()- >FindBlock("expression0"));}4 X8 a: P* n7 T( c
caTCh(exception& ex)
0 I: M2 d1 C+ ^- v* p1 I/ u {- {8 r7 n8 Q) U) R( | T2 L- ]% i
//---- Enter your exception handling code here -----' h- c3 x. a$ \1 k; Z+ `; H" |
selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:dialogTypeError, ex.what());
) |9 Q, N( |8 b6 r }! P" h+ @6 L0 r3 q1 y8 r/ y
}" Y$ h4 i# o; y1 b$ K; ?* g
( h! c3 ?" ?/ Z
int selectedge::apply_cb()9 W# n9 q/ w5 @0 T# w+ i
{
4 `# Q8 P9 v1 ` V int errorCode = 0;
) z# P( h. o, k/ ? try$ w4 k1 O, M6 N6 V
{( ~3 P/ ]! P6 {$ q
//---- Enter your callback code here -----3 _0 i* m! j$ {! \ o4 o8 Y3 |
3 }% f4 @) n# K0 L) v( Q# O8 t! M: N0 G) O, D& T. ~8 H( g1 d4 |
6 ^3 e+ d$ n. D7 ?0 K0 m% D. l Session *theSession = Session::GetSession();$ t5 M0 B, j- x+ K
Part *workPart(theSession->Parts()->Work());
/ [& L: `: A5 j4 Z Part *displayPart(theSession->Parts()->Display());
/ U2 m% Y K4 ^- c6 Y8 a- K& p( U! {! h0 c* ~# `
3 C+ h6 K. i0 ?4 @! {2 Q4 t2 w( b
Features::Feature *nullFeatures_Feature(NULL);
1 j0 Z B& L: C( \0 O. F Features::EdgeBlendBuilder *edgeBlendBuilder1;
" a1 E8 X8 x7 ^" @$ g4 u edgeBlendBuilder1 = workPart->Features()->CreateEdgeBlendBuilder(nullFeatures_Feature);
: X, W0 ]: g0 Z1 g0 q0 K# Q5 X% `5 Y- D, o+ B" K
2 L# f# \. D. |/ U0 J$ W
ScCollector *scCollector1;1 o6 x8 e: ?. S, S5 B
scCollector1 = workPart->ScCollectors()->CreateCollector();
- L- U- I6 O7 }8 V0 c+ f, @& m3 j2 g9 J. F
3 M- d) i; s( @: ?! A
std::vector<Edge *> seedEdges;
/ a4 w2 `9 A! V P
. S) q* ^. t2 H: S W: W4 d1 R std::vector<TaggedObject*>selectob = edge_select0->GetSelectedObjects(); //获取选择的对象0 t5 G t1 s, Z' J- V
for (int i=0;i<selectob.size();i++)
6 M$ D8 A- z' G3 B8 k/ ^ {
1 q; [ E( U: M seedEdges.push_back(dynamic_cast<Edge*>(selectob));
- u0 F6 o+ f0 L5 h* j4 V2 @: \ }
7 C$ z; r2 A( v) Y/ x9 z" G! | P. G* ~! G# K( t* P. d- c7 r% I8 j3 r
double dia = expression0->Value(); //获取表达式的值; [9 H" B7 @5 n
stringstream DIA;
- b7 m( x2 s- T) i. B DIA << dia;& X" M* n8 t$ R* a6 n9 |4 p
3 b5 Y) c8 }6 y7 [ `
/ k5 i; |6 z- ?- `# t+ A
EdgeMultipleSeedTangentRule *edgeMultipleSeedTangentRule1;" }! b- Z1 ^+ b9 c: N0 P. l
edgeMultipleSeedTangentRule1 = workPart->ScRuleFactory()->CreateRuleEdgeMultipleSeedTangent(seedEdges, 0.05, true);
5 I J. M8 [: A$ B0 G1 u6 N6 g0 Y7 z' g; d g
( Q: L, ~! H2 c9 z4 n t; [0 m std::vector<SelectionIntentRule *> rules1(1);
5 V7 w [! a0 h% Z% G# m7 c( ~ rules1[0] = edgeMultipleSeedTangentRule1;
1 f$ Q+ ]5 B) `8 S" o( q scCollector1->ReplaceRules(rules1, false);
3 {) M# J! q" v ]/ U# f- `+ t: \# z# x- v$ ^+ y: ^% v
# i4 k% E* h" \/ S3 ]* Y edgeBlendBuilder1->SetTolerance(0.001);
- ?7 Y- a: B8 S- q3 N- f5 x
/ @( M$ v3 q; c! b, g0 f, }( Z- @: ?3 \
edgeBlendBuilder1->SetAllInstancesOption(false);
( [9 k- p8 @) z$ S4 W8 K0 p* B4 W7 \$ r, P7 ~+ G0 j4 O! u: ^
- k9 A% K- S# V+ N
edgeBlendBuilder1->SetRemoveSelfIntersection(true);
) D7 h+ b9 O4 P9 m1 Q& n k4 i9 ]; V) T- k _$ E6 {' x4 j
4 p, Q" \* f! m; H edgeBlendBuilder1->SetPatchComplexGeometryAreas(true);
|. [, P7 r( n
' |2 U! i8 o @& b+ v
4 W1 T+ x9 n& I# ^: @ edgeBlendBuilder1->SetLimitFailingAreas(true); X4 s7 {! _4 p6 ~' v9 v
& D2 A; S: W. P( x9 f& E S6 E' U* I c% A0 ~
edgeBlendBuilder1->SetConvexConcaveY(false);# q5 R5 y! u( G# r$ V" ~
3 I& \9 o4 b* K; t9 ~8 {( E9 a+ \# E7 B2 Y0 z/ Q% B, Y
edgeBlendBuilder1->SetRollOverSmoothEdge(true);
+ E+ f5 o( a7 h% r# Z
; l& L. J G7 @2 N- s3 M* G' {2 Q9 t- p! \/ f/ }8 K! s4 ?
edgeBlendBuilder1->SetRollOntoEdge(true);* ]8 X8 a f: g7 H5 Z I4 d0 V! T! O
V& |/ M: i6 o1 d/ c
+ o' I1 t" `4 f" V+ D. i
edgeBlendBuilder1->SetMoveSharpEdge(true);3 y" I* F0 [( ?! L8 n4 G2 j: y, `
1 l8 c$ P, s1 i# n6 K
* Y0 N+ u5 K" n6 }+ c/ [
edgeBlendBuilder1->SetTrimmingOption(false);
. R$ T; `5 E" |" H8 a/ r/ `
; \0 b5 Y+ S1 _2 \
7 y: |2 U$ {' E edgeBlendBuilder1->SetOverlapOption(Features::EdgeBlendBuilder::OverlapAnyConvexityRollOver);1 ^( m8 Q0 r& B2 v
! E/ r0 ?/ y3 H" F& z3 A
$ v# u' Y- X9 ?2 J( Q4 L' U edgeBlendBuilder1->SetBlendOrder(Features::EdgeBlendBuilder::OrderOfBlendingConvexFirst);
/ e U/ q+ {+ x3 ?$ ^( I/ r
: F: _ l* u: M* m% y0 z
+ L. \% |1 ]5 `! P1 \' I2 V edgeBlendBuilder1->SetSetbackOption(Features::EdgeBlendBuilder::SetbackSeparateFromCorner);
6 r9 W0 D9 F" e/ q9 O( C- @
( w; B% c/ k' u2 l3 v3 f1 O. n! I( n& b
int csIndex1;# I4 s6 b/ e; o0 I- l R7 A2 F
csIndex1 = edgeBlendBuilder1->AddChainset(scCollector1, DIA.str()); i2 e, g: o% n9 g
2 U; K& U! I/ N1 k* p) V% m
# P$ O& F" ~0 i0 x; i$ d Features::Feature *feature1;
; c$ Y+ E( h( ] feature1 = edgeBlendBuilder1->CommitFeature();
: Q& L: M' O# _9 L8 l' o6 g# C$ W, [3 W, ]: p$ [
% u) h8 `& z- F/ c edgeBlendBuilder1->Destroy(); n" @& D8 Y; i9 L* D
+ _3 r6 T" b O! ]3 W( }/ } }
; Q# x" _& [7 l: v8 }+ k4 L catch(exception& ex)
, ^3 {2 V! k$ Y" E1 V {! @/ H% O) ]8 o s6 W/ F7 I
//---- Enter your exception handling code here -----, g7 h- j( X3 i T2 L
errorCode = 1; q4 ]$ L& ~+ u
selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());0 Z. m9 X' X% h5 M0 }/ [8 ?2 f! S y
}5 g; X0 G7 N& O
return errorCode;
4 x4 Y3 t T+ H1 D7 H) \: o}
) S. |1 V/ B) `
6 y& j4 s8 v3 d( F4 t7 Q/ D说明:因为字数有限制,这里只贴出关键代码。. d* b2 p3 H" Y. q; y7 G
! x8 R3 g. j, W3 y- B
6 X7 T0 w1 w" c+ V. M$ P
' |( T3 h7 r' G, \* u8 o3 d |
-
评分
-
查看全部评分
|