|
|
秋爱
发表于 2015-8-15 09:15:43
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
/ @+ }- t6 m F
void selectedge::initialize_cb()5 k3 D3 v/ w6 u- p
{
) N: k0 p0 K7 P) T try8 H6 _- X" [5 a8 {. w" U5 m |
{2 D& {* R( C$ i' G9 b
group1 = dynamic_cast<NXOpen::BlockStyler::Group*>(theDialog->TopBlock()->FindBlock("group1"));4 U$ ^; M1 \ K
edge_select0 = dynamic_cast<NXOpen::BlockStyler::CurveCollector*>(theDialog->TopBlock()- >FindBlock("edge_select0"));
1 s& y$ v R$ f9 x" m expression0 = dynamic_cast<NXOpen::BlockStyler::ExpressionBlock*>(theDialog->TopBlock()- >FindBlock("expression0"));}% v& y; g& G! |/ y
caTCh(exception& ex) h2 f+ M: [1 x- C, m& w1 r+ Q. r
{
" c3 ]/ H. Y2 n+ \3 U //---- Enter your exception handling code here -----6 l. \6 y* z6 J! h: v
selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:dialogTypeError, ex.what());
0 Y8 c7 e+ m9 ~: c/ y0 O }
3 W9 T" d+ `' S5 ~- Z1 r. U* F' P}) z6 T, {8 e; c8 o5 y/ K' n
# [! R9 V/ t( O' f; F% lint selectedge::apply_cb()9 [$ ` d! H v! @! Q( V# Y& N
{
4 P3 o& y# ~3 ~7 r- @ Y& q int errorCode = 0;) A# Y% _6 }& Z, L0 t n! h7 i4 d
try
+ Q W- B. J9 o* s {3 E* h1 M$ ]; t3 Z
//---- Enter your callback code here -----6 Q: D: s: }4 K5 [
/ }* z8 R; h5 d% r9 x9 Y
$ S. |2 h1 S1 c/ x* [3 f4 y8 s2 b3 a; F1 N! g
Session *theSession = Session::GetSession();8 O0 U% M. {5 O# u- \+ r
Part *workPart(theSession->Parts()->Work());
) O2 _* |: I- G" P2 P/ n% i Part *displayPart(theSession->Parts()->Display());: B% ]+ x. ~4 ?" b5 Z) G& y D
% X% i+ x5 y# q5 R% g, M
4 L; q5 }; V/ b% y1 @- m, f# y
Features::Feature *nullFeatures_Feature(NULL);
+ p3 b! { I9 l7 j; q9 Q Features::EdgeBlendBuilder *edgeBlendBuilder1;: g X% Z0 _) H! G
edgeBlendBuilder1 = workPart->Features()->CreateEdgeBlendBuilder(nullFeatures_Feature);9 S0 I! b+ g' P+ Z3 Z
3 i* i8 H" N. k2 F9 E4 Y8 p8 d. A' h
ScCollector *scCollector1;5 _ I1 e! Y: G0 s, y
scCollector1 = workPart->ScCollectors()->CreateCollector();1 t& R, w9 j% k# L9 ]2 q" o
5 e, j% c: v* n9 u/ q+ }7 n
( @8 Q/ Q( ?" G) v2 y/ ~ std::vector<Edge *> seedEdges;
" k' b3 \: L# O8 _- J2 y# M( m( m ' ^5 H3 F: ^' y5 x& q) C& ^4 P) O
std::vector<TaggedObject*>selectob = edge_select0->GetSelectedObjects(); //获取选择的对象
M- @8 j b, n1 ` G for (int i=0;i<selectob.size();i++)
2 {4 F) q B7 U+ D; N$ j {1 q' F4 T/ K9 e
seedEdges.push_back(dynamic_cast<Edge*>(selectob));
3 U7 j. A6 y* i4 i C* e$ i }% K1 q: `- w( {: [( n5 l. J
2 y1 R/ W% ]" T% ~1 C2 b+ ^' y
double dia = expression0->Value(); //获取表达式的值0 o; x5 D; ~+ `3 @% t& u* j- v
stringstream DIA;- }9 Q, v' q* u. U" |
DIA << dia;2 `2 `6 P& W6 X J9 [- a, z0 Y
' a8 y6 }6 k# H
6 Y" X: L! ?/ ^% G0 f9 D+ v
EdgeMultipleSeedTangentRule *edgeMultipleSeedTangentRule1;" T+ k5 P9 S. |! I; Z. O! ~, S. x
edgeMultipleSeedTangentRule1 = workPart->ScRuleFactory()->CreateRuleEdgeMultipleSeedTangent(seedEdges, 0.05, true);( p1 o. r" V! @, L+ Q. S- ?( l% K
) D( k N9 r- V- d/ u2 w
' q3 M4 _6 o% V; m std::vector<SelectionIntentRule *> rules1(1);! n8 ?# \' L) G7 B
rules1[0] = edgeMultipleSeedTangentRule1;6 z& K0 a% V6 R4 s" v
scCollector1->ReplaceRules(rules1, false);( q0 _: i9 u, ?/ X, h; f
; s- A: x3 z( X9 E
/ n& p4 c: B1 G" C. o/ G( ` edgeBlendBuilder1->SetTolerance(0.001);. F. j5 j& a$ W' P; g o$ O0 z% g
/ P3 D; ~+ |. x7 v
$ M4 O0 I9 S% C. m( U( Z edgeBlendBuilder1->SetAllInstancesOption(false);, P- u( u. a$ f3 V# P# `' ]
0 s! r0 F2 ?+ e% ]* w J! m3 K/ Z0 `9 R
edgeBlendBuilder1->SetRemoveSelfIntersection(true);
, R6 P( B4 k! {# V4 m. o2 ?2 ^4 L/ S+ W- s
7 r, F; y' z x: ?" E# b edgeBlendBuilder1->SetPatchComplexGeometryAreas(true);
4 F: C/ Y1 n9 W( x" G! M1 e" r
) r0 V: U J& P) [8 w# }# {. F* P5 y6 R4 T( t0 @) k/ y8 x* K
edgeBlendBuilder1->SetLimitFailingAreas(true);' r. t& d" Z. c, i! D: q
' G# f3 C" \* u3 `) h+ c
: b2 c% z! d$ W5 e% F edgeBlendBuilder1->SetConvexConcaveY(false);
- b s, N0 Q% y O5 q
8 X+ O9 B& A% y% j5 L- R/ ], K L ^
) S% b7 @8 g) H. y$ P& Y edgeBlendBuilder1->SetRollOverSmoothEdge(true);
- {3 e+ U. I6 A4 _4 t# ?$ W! [& r
$ g+ X0 V9 u- u# _' x' I- g) G' w edgeBlendBuilder1->SetRollOntoEdge(true);8 P" `3 h* [' P, Y3 R/ ^
: b/ G. {6 ~; k
* M; m0 l5 P* u: I$ G! G3 i% U; K
edgeBlendBuilder1->SetMoveSharpEdge(true);
3 l3 I) K- i5 a9 [# _) v
! O7 L" G( Q+ Z( f8 ~! j% u) c* E2 a/ I! o# B7 p
edgeBlendBuilder1->SetTrimmingOption(false);
$ c, T$ l6 I8 y# z, @, h
7 l7 W! T |8 i# [8 ` E1 W
+ ^2 X- S$ E Z+ U7 ` edgeBlendBuilder1->SetOverlapOption(Features::EdgeBlendBuilder::OverlapAnyConvexityRollOver);% n6 B- v3 u; h7 w7 i( n
7 X& F4 ^ E! {: ]; m4 M1 M0 M
- w- T& n" o( L: g8 Z
edgeBlendBuilder1->SetBlendOrder(Features::EdgeBlendBuilder::OrderOfBlendingConvexFirst);
) S5 W9 n4 J/ |( P- |1 ]) j+ p g% @5 G9 v7 F% c. U
5 d' n0 B* s9 U& d) c- z7 `
edgeBlendBuilder1->SetSetbackOption(Features::EdgeBlendBuilder::SetbackSeparateFromCorner);6 T0 w. u4 Q5 q- q% |; a
% ?$ b7 B* Y8 J
- E& G6 s, m# A5 _- o9 f' r" g int csIndex1;, c3 E) n' I+ E2 w5 n! I
csIndex1 = edgeBlendBuilder1->AddChainset(scCollector1, DIA.str());
2 U3 s1 g; Y+ I3 ~* H0 B
( |' L7 P( M3 x+ |/ C6 E4 ~% L! }+ R, ?0 \
Features::Feature *feature1;( _. V" ?: ?$ W( @
feature1 = edgeBlendBuilder1->CommitFeature();
]. }8 S' f! H3 z9 [( S0 `/ K& ^# r g2 _" Z* p% {6 s; _4 c
) y, l8 x' ^$ T* F* G
edgeBlendBuilder1->Destroy(); r! h& }! [4 H# `6 Y
) U0 V* D4 M/ _' A2 j2 [7 m( K
}- t- v- U+ O( c# Z) ~8 m
catch(exception& ex)) W. Q8 l- ^: g# T& K& d: ]
{
7 a6 }' y% M/ [6 y7 t //---- Enter your exception handling code here -----
. V. o; Y( K- |4 j0 c4 r4 ?) `0 L5 L errorCode = 1;
; C7 M5 x) `+ Z- C; ~7 A% i. b; b selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
3 n( Z) P* j; Q0 x( f }
; Q- O1 T# N+ P- Z( P8 a2 B return errorCode;8 i2 R3 I2 J% j
}
/ C% o4 n" F- N2 y/ |9 c/ ?( t- k2 a3 G
说明:因为字数有限制,这里只贴出关键代码。
9 E( s6 A2 |* F: N/ g# p
0 ?2 @! v* c5 S" |- Q/ K- L1 n9 H- z' s9 ?# z7 m
* e) s- o3 a! L- E |
-
评分
-
查看全部评分
|