|
秋爱
发表于 2015-8-15 09:15:43
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
4 p) Z' r0 n3 _% N1 w
void selectedge::initialize_cb()& s; G* G' a" L! V
{3 z+ d( \3 e( x7 ?
try
) m* \9 s4 d& [& L {4 H( `8 ~! v0 r4 ?
group1 = dynamic_cast<NXOpen::BlockStyler::Group*>(theDialog->TopBlock()->FindBlock("group1")); u+ s! _& C" A' \- l( B+ e
edge_select0 = dynamic_cast<NXOpen::BlockStyler::CurveCollector*>(theDialog->TopBlock()- >FindBlock("edge_select0"));
! o' ~* F" d% n! |1 h expression0 = dynamic_cast<NXOpen::BlockStyler::ExpressionBlock*>(theDialog->TopBlock()- >FindBlock("expression0"));}! A) D1 @% I+ J. O8 Z& l
caTCh(exception& ex): v1 _9 V, p5 ~0 F) w; G- M
{
# w v1 R; m4 G5 U* S- v4 H2 O //---- Enter your exception handling code here -----
" J4 v, s6 s" a selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:dialogTypeError, ex.what());+ e0 c) b# H: O0 O* Z
}& `: @8 t3 {! f& c. `0 j- T& d5 H
}
. b6 j4 d3 U: G u
/ ]+ }0 `3 Z4 n/ e3 }, `; Jint selectedge::apply_cb()
1 C1 D' z4 T) |( ~9 N. ~3 o, d1 ~- z{
$ w3 H3 d8 n: }1 m int errorCode = 0;
( |$ |" }% r3 p& j1 L; g: U try
^8 e& \0 q% ~9 B$ | ^ {
- d; w, M# i) R% U) E //---- Enter your callback code here -----
. f" G7 j# r% O( |" `2 h* B {1 o. m% s. }1 T4 \6 ^
! |& @9 |# ^6 U8 J' x) m
" r s/ S2 s8 P( { Session *theSession = Session::GetSession();
9 H/ f0 m# K j& W Part *workPart(theSession->Parts()->Work());3 v- X2 H; _) u6 z4 K; j' R& l7 b
Part *displayPart(theSession->Parts()->Display());3 N0 L/ b$ O' ]" G8 t3 }$ ~& i( u
2 x3 R+ B1 Q5 U9 @+ T5 M1 _+ O5 s+ ~0 x, W. c% j6 l3 W
Features::Feature *nullFeatures_Feature(NULL);' x- d' ]/ U) w. h' r1 |2 t* G6 ~
Features::EdgeBlendBuilder *edgeBlendBuilder1;
U& G9 @/ D' m0 D2 f edgeBlendBuilder1 = workPart->Features()->CreateEdgeBlendBuilder(nullFeatures_Feature);0 K& ^; O5 ^6 A3 r$ ^, `+ ^5 M& y4 Z
6 Y" A3 W; h2 A# H# V- z4 U% j% u$ t
ScCollector *scCollector1;' e" N7 Q& Y& |* d
scCollector1 = workPart->ScCollectors()->CreateCollector();& l! z R; I# D4 \" B* a3 v
! z' s; R( v0 R. O3 ?
- Q7 z8 Y' p$ ^' u$ f- B
std::vector<Edge *> seedEdges;
; Z! ?( z# o# C& w$ W7 w A+ d. L$ u w
2 n- i: V! |; L* v3 x5 ^ std::vector<TaggedObject*>selectob = edge_select0->GetSelectedObjects(); //获取选择的对象
* f, p6 u0 k, r6 Z/ v" h0 R2 z( u for (int i=0;i<selectob.size();i++)" ~, Y( r% T7 ^" m
{
+ a: {$ P, S& H9 ` seedEdges.push_back(dynamic_cast<Edge*>(selectob));$ h! i% G* `, G: S# i1 s" E
}* G% l) c5 u9 x
. A$ L( o" c' Y. w! \) S y
double dia = expression0->Value(); //获取表达式的值
8 V8 \( e V1 ]0 M% ?3 L stringstream DIA;* b' j; h' ~; J0 I: F) M
DIA << dia;* B) x$ A% N$ w3 F4 U
$ L# g1 t# D, d% N% @: o* u, U l8 I9 u. W8 a) R4 |
EdgeMultipleSeedTangentRule *edgeMultipleSeedTangentRule1;* i7 b6 T" P5 W* Q* v( Q
edgeMultipleSeedTangentRule1 = workPart->ScRuleFactory()->CreateRuleEdgeMultipleSeedTangent(seedEdges, 0.05, true);
) X' v- B% q4 v1 L7 B6 H; h; H1 Y/ e- g, }6 n1 c# {
' I/ v8 u5 R- H* J1 _ std::vector<SelectionIntentRule *> rules1(1);
) S# `7 O% h+ W6 p; [/ z9 r rules1[0] = edgeMultipleSeedTangentRule1;* o0 j1 M! N6 `* P( f) b+ a# m
scCollector1->ReplaceRules(rules1, false);/ h) y; X* K9 Q( R" t
0 O8 Z/ Q8 [ R# b" ^2 J4 U
+ k" P M2 f+ c3 i. d8 X9 U6 e. R edgeBlendBuilder1->SetTolerance(0.001);
, l/ |/ h& Y* @8 W' Y& U4 b! I% `) r0 h+ o* o+ V
8 @9 J4 H/ l) l, Z2 v9 c edgeBlendBuilder1->SetAllInstancesOption(false);
: ]" ~4 C1 ?2 G
6 _+ H* Q. _' E9 f x: e
" O9 l3 \% J5 m5 y edgeBlendBuilder1->SetRemoveSelfIntersection(true);
- J! b# k ]% M& _9 l2 ~+ ^& H: u4 f# j% b$ R: ?" k! B3 U
2 q. V! v6 f: {
edgeBlendBuilder1->SetPatchComplexGeometryAreas(true);
9 B4 C5 }( H& a& f6 b! n# S
* i, q" B. z4 {8 g- \* d- I! j2 R
edgeBlendBuilder1->SetLimitFailingAreas(true);7 L/ l" R5 }5 l7 f8 X& D- W, a8 g4 d
; `: o3 h9 {4 ?- i4 o ?0 Q A
7 F j$ S+ E( {' m
edgeBlendBuilder1->SetConvexConcaveY(false);0 [& J# [0 `# e
c; R& d+ W' l+ t# d
) k: E0 k' x# v3 _4 r+ M edgeBlendBuilder1->SetRollOverSmoothEdge(true);
# g! `8 S: z$ p5 C' e0 @; O" S& a6 `+ Y! _0 j$ j% `
! K. e# ^: P. f1 l edgeBlendBuilder1->SetRollOntoEdge(true);
T* }* Z& v5 e
9 Y" c, j5 B2 B+ t/ V% C D1 Q+ m" N' h1 @5 [$ H i. l
edgeBlendBuilder1->SetMoveSharpEdge(true);
) N1 ~7 @; I: M+ ] G" H) j
* l& c2 t$ x4 G+ [" x7 v: {# M2 q& J* o3 R' G D
edgeBlendBuilder1->SetTrimmingOption(false);
4 ?1 r* k9 y; `: g0 u; f W
& m0 o8 Y5 ?+ U# M/ A; P3 E) v3 {% w
edgeBlendBuilder1->SetOverlapOption(Features::EdgeBlendBuilder::OverlapAnyConvexityRollOver);
' O# X6 M$ E: W( b2 p
9 [) _7 p' i* b% U, [1 D1 o# _ x8 H+ K9 a( W# s3 w
edgeBlendBuilder1->SetBlendOrder(Features::EdgeBlendBuilder::OrderOfBlendingConvexFirst);$ M0 H3 `3 _/ E. c3 }/ x
1 s3 e8 [/ P; G1 y$ C0 b4 i0 s
+ Z5 J5 X3 m8 t; v' O edgeBlendBuilder1->SetSetbackOption(Features::EdgeBlendBuilder::SetbackSeparateFromCorner);
/ q1 l3 i8 s! r' s* o+ V
' P1 F9 j5 ~0 @; A! g) i, T& ^6 b
9 I# C8 g5 C* p6 T* a int csIndex1;
* K" W& I# \2 p I |+ ? q+ F: v csIndex1 = edgeBlendBuilder1->AddChainset(scCollector1, DIA.str());, }4 @4 h$ H) _9 `
, O2 T# i p: Z
; r7 r8 H+ ~8 W0 A) _
Features::Feature *feature1;6 R* s/ S% e6 ~4 a' ^" ]
feature1 = edgeBlendBuilder1->CommitFeature();
2 R9 X7 L& h1 T! ]4 {, |! ~9 E) W I8 e7 S: M' }% m& S6 R/ a/ |
( ?& S) q9 @/ C
edgeBlendBuilder1->Destroy();1 l0 f6 n, f- h, V' u' N% u$ |+ G
* R( V* @- s) d3 J1 i0 r) r0 L) G: h }$ V0 f, n" V) s1 J% e8 B5 b, y
catch(exception& ex)
, h7 D! B$ u% X8 E {
( b- H4 L- c, s$ O# C5 m //---- Enter your exception handling code here -----
S b0 k: X6 |! j errorCode = 1;
" y' u, E& m& Q+ s( E7 V selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
, w% K M! k7 m* b+ ` }
: e G: Z/ @( A return errorCode;
5 ?& \& k0 h/ j |}9 A* ^$ b f1 b5 c+ T
2 s- x& s& f- d! |" T! L说明:因为字数有限制,这里只贴出关键代码。5 X8 J, {) Y7 I1 f# W; U- }4 h
; w( }) ^! P9 I
E% L' b4 [3 A1 w& T
6 {5 V5 \; c( J
|
-
评分
-
查看全部评分
|