|
|
秋爱
发表于 2015-8-15 09:15:43
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
% C" S( O6 o) z0 G1 k2 e
void selectedge::initialize_cb()* W7 S% T' f0 E0 a" R
{
8 z, k( H, G1 M0 | try) G. a% @( q$ k; P' a* ], @2 L( M
{
m$ X0 x2 Z" a7 r: Q0 Y: S6 n group1 = dynamic_cast<NXOpen::BlockStyler::Group*>(theDialog->TopBlock()->FindBlock("group1"));2 N$ L$ u* V8 l: r" f! o
edge_select0 = dynamic_cast<NXOpen::BlockStyler::CurveCollector*>(theDialog->TopBlock()- >FindBlock("edge_select0"));: z3 k$ M" W% r- J! h# I
expression0 = dynamic_cast<NXOpen::BlockStyler::ExpressionBlock*>(theDialog->TopBlock()- >FindBlock("expression0"));}
' K+ q# a% [. O0 C- p* Y& [ caTCh(exception& ex)
& W: i: f$ n! H; W% {, o8 D {. m) ^: w# D8 T, M7 q/ V% C
//---- Enter your exception handling code here -----
, `( m# L' t3 I+ o2 ?0 O6 A selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:dialogTypeError, ex.what());
. S+ O5 l. ?" U r: e6 u6 \& a }- Y+ S! P1 X0 s
}
* z( G" A! V0 f d9 B {
( `8 J2 ?, z% z# U3 gint selectedge::apply_cb()3 Y) R- J( q4 K' @
{4 a& |& r: o# c: x: G# V+ a. R& f
int errorCode = 0;% r$ j/ x9 f( l4 M5 H T
try
+ s) }0 e7 I D; o" p9 h {
& z. F; \+ x( ]7 ^2 K //---- Enter your callback code here -----
% `& r4 T* F" v2 `7 F- x$ x
% I; @$ Z" V) N- z( I% v, r: E7 k5 `2 a) o% ^$ `: g" Y% h# i& N* X4 j
! @- o9 E4 b5 q/ h) a Session *theSession = Session::GetSession();
6 D- Z0 s' q; m7 a: E1 a9 W! @ Part *workPart(theSession->Parts()->Work());. M5 Z( g5 a/ J7 Q" U, [$ y0 z
Part *displayPart(theSession->Parts()->Display());
3 e$ a0 A: A: C3 U) u2 _ ~( J9 w
3 Y. B9 r2 s7 }, c) `+ L$ T$ T
Features::Feature *nullFeatures_Feature(NULL);& D& h+ ~# U: c/ v3 T4 t# }
Features::EdgeBlendBuilder *edgeBlendBuilder1;* K( J& V z5 r; U
edgeBlendBuilder1 = workPart->Features()->CreateEdgeBlendBuilder(nullFeatures_Feature);
/ L" P( q6 G; t: f# D, F; M' s; b0 N
# f1 }; C- O+ U% O8 n$ B ScCollector *scCollector1;1 |( W0 w, @% c" o
scCollector1 = workPart->ScCollectors()->CreateCollector();2 l- h1 ^0 T! w5 B
+ s- N) z6 \2 t" C
% u$ t, u$ [ |1 ~ G& U std::vector<Edge *> seedEdges;
5 C$ V' e# w8 N
- O1 q$ i9 k8 Q% [# N& K' F ]1 E, V std::vector<TaggedObject*>selectob = edge_select0->GetSelectedObjects(); //获取选择的对象$ A' K3 e) V" q. O0 Q2 e3 `! O
for (int i=0;i<selectob.size();i++)
7 v0 j8 B, `( ~ {
" m: n) Z7 b' b# L# ? seedEdges.push_back(dynamic_cast<Edge*>(selectob));" x A% ]: x- u8 u7 G
}) k0 w8 ?) P# |7 q) T
+ P0 a% O0 m% k$ Y9 Q0 S: d9 a
double dia = expression0->Value(); //获取表达式的值) y# X( A9 _8 H2 o: ]9 ]! c
stringstream DIA;
# q& L3 s2 H5 h+ r$ z- I; j. H0 g DIA << dia;
' i# V5 T; s* h4 P
3 _, V: q; e3 V _6 i
1 e- E' d& f' [* ]' b6 d EdgeMultipleSeedTangentRule *edgeMultipleSeedTangentRule1;
4 p5 l3 i; ^ f' r5 A2 x edgeMultipleSeedTangentRule1 = workPart->ScRuleFactory()->CreateRuleEdgeMultipleSeedTangent(seedEdges, 0.05, true);
# p% i- b ~+ m7 j/ _/ x5 f! _9 l& ^, [# W* e/ A& d4 f8 |& R1 U: f
. o2 f+ s9 X: _ std::vector<SelectionIntentRule *> rules1(1);
: S! z. W3 f' L- d* E2 e; K rules1[0] = edgeMultipleSeedTangentRule1;7 d* F, E6 n. z9 L
scCollector1->ReplaceRules(rules1, false);
" |1 e( p# K' C( [/ t6 }. i- N' x$ _3 {
2 ~9 Q i/ q( L. v* `! h8 ] edgeBlendBuilder1->SetTolerance(0.001);
+ [0 J+ S2 B, U7 f9 H# q: M# q* g6 Z
* j- h; e/ v& F! V$ G2 Q% V- |' B4 ]
. z$ Z) q( i1 H edgeBlendBuilder1->SetAllInstancesOption(false);! E: w- N6 q+ y* L1 @9 m
) L/ A' J, P& H5 Q3 p3 i0 f
! Z$ c t# a, j' {' ?3 O4 e edgeBlendBuilder1->SetRemoveSelfIntersection(true);
! A6 D4 K" h+ Y- c8 s, N& ?; x3 s- h, G. r, F! j1 Y
0 x$ U" P# c, X+ q2 c# N edgeBlendBuilder1->SetPatchComplexGeometryAreas(true);5 \0 _- N# ~4 h
9 Z/ b' K( d1 K
7 H e2 `* K* b" g/ X& H, Y- t edgeBlendBuilder1->SetLimitFailingAreas(true); F0 c2 H* N+ @0 O4 r' W8 W( W
$ Z8 R) F4 k0 C8 n; X5 c" @
0 v2 I |+ g+ Q( }. c4 M edgeBlendBuilder1->SetConvexConcaveY(false);# K0 N- e5 X( u& j2 }( }6 z+ Y: {, S
: d: G& i8 ~3 K
0 [. i+ s7 I- X' ?( w* O& v edgeBlendBuilder1->SetRollOverSmoothEdge(true);
' @7 G+ x; R0 P5 d0 E6 _: q, f: A" p5 K5 c7 y6 T" B* y
1 G) t L0 R% _6 o, b edgeBlendBuilder1->SetRollOntoEdge(true);
# O" f e4 F6 [ ^( n
8 r! ] k( D7 {0 u9 [' z+ Y. {
9 c8 o: |4 _9 G7 l D) Y edgeBlendBuilder1->SetMoveSharpEdge(true);, m) U, B! a9 M5 L1 O
& Z% M4 p3 q& V/ _) s' h% m# T4 M
8 _! J4 G' ~ H; K" E# ^
edgeBlendBuilder1->SetTrimmingOption(false);
$ L7 f3 T u0 i' q- n) {# c! o7 I
`1 G, h" W/ Y2 M* [( d9 c! p0 A" |
edgeBlendBuilder1->SetOverlapOption(Features::EdgeBlendBuilder::OverlapAnyConvexityRollOver);0 I; Q7 T( ~7 p- B
0 C% A) e$ T$ O7 o
7 F* ^8 ~, D* h, I: l/ W4 g0 Q edgeBlendBuilder1->SetBlendOrder(Features::EdgeBlendBuilder::OrderOfBlendingConvexFirst);
' i( f- M3 w$ l/ M) l3 [9 D$ J Z" Y7 j5 h; M9 B
; }/ f8 D* x2 W, f4 { edgeBlendBuilder1->SetSetbackOption(Features::EdgeBlendBuilder::SetbackSeparateFromCorner);
: z% e8 _3 H3 M6 U) I1 x
/ v7 u; X& q4 Z/ l& a1 M* A# ]1 J! M; p4 }8 ~2 N
int csIndex1;
# j/ Z- O/ D- \1 v' r1 ]1 _! `7 R csIndex1 = edgeBlendBuilder1->AddChainset(scCollector1, DIA.str());8 Z/ w' f' i( T: D9 E7 o
2 {/ _5 F/ {% }2 ]5 v! a4 p; J
+ N6 h, N/ d0 Y7 _: |7 A# ^7 } Features::Feature *feature1;0 Y8 R! Z: M- M6 K: O1 Q2 G
feature1 = edgeBlendBuilder1->CommitFeature();
- W" h1 p$ S @0 _7 b. z3 F
& |% l" p! Y8 |+ Q3 @* P- B
: A, k* g& l# X( U5 c+ {( n- ?0 j' k edgeBlendBuilder1->Destroy();
3 |- A* u9 M: v: w6 K- A/ U* t$ b. y9 ]
}
7 c2 A: t3 K+ \" ] catch(exception& ex)( G: g: Q0 ~. g! l
{2 x( o8 ^% s# z1 [3 W( B, _! j t
//---- Enter your exception handling code here -----
4 F9 n, l C; r* w& l$ X; m0 ~( K errorCode = 1;! B1 f7 V6 r. n, j/ B n; t! l
selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());/ W% a3 r l, g0 l4 |5 `1 n
}
. V; R' U9 e* m& c& G5 e return errorCode;& f7 `- G$ y# Q4 x* ~$ E
}) P9 l* q' \( r$ ?
9 w ~, P! s$ U& J
说明:因为字数有限制,这里只贴出关键代码。- w3 l8 g* s% x
- j4 ^3 _4 j2 J: x; s$ m' T# V
! Z9 g- C+ w& A8 ~; g4 |6 Q: \# Z6 ?
: u" [# @) `1 t1 o J; _ {5 x |
-
评分
-
查看全部评分
|