|
|
秋爱
发表于 2015-8-15 09:15:43
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
3 p8 T S- @3 [* u0 Uvoid selectedge::initialize_cb()
@! z3 D L) [- P% Q{
7 {+ g+ f$ r( H4 y5 u try. H- Z6 A0 Q9 H4 }% x" p9 Y9 V
{ u' k* j: }) C4 |. ~% V) t
group1 = dynamic_cast<NXOpen::BlockStyler::Group*>(theDialog->TopBlock()->FindBlock("group1"));
3 t; q8 @1 f$ L2 E* o$ d. O edge_select0 = dynamic_cast<NXOpen::BlockStyler::CurveCollector*>(theDialog->TopBlock()- >FindBlock("edge_select0"));7 l* G- r( F: M
expression0 = dynamic_cast<NXOpen::BlockStyler::ExpressionBlock*>(theDialog->TopBlock()- >FindBlock("expression0"));}
5 k/ V$ P# X0 M( d7 M) ~/ P caTCh(exception& ex)
_$ M8 n, M) r9 G) } { K n* D2 @% Q4 b
//---- Enter your exception handling code here -----
/ z& S1 K w) z$ ? f0 F selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:dialogTypeError, ex.what());7 L) O1 w4 a+ \$ u) L
}
0 J7 o5 O; p- g& o6 p% V% d}2 Y- w0 T; Q1 Z. T' m# A
+ b/ p) h# D: J4 C U* |, m
int selectedge::apply_cb()
' L6 k1 K% ?' M) n+ L+ I{
( R0 s- ]; _; M0 p. r0 m# ?4 ? int errorCode = 0;) k, J- o# x0 D# b* i& ]
try8 S! d/ d' g8 v4 y) U
{
' X9 E9 m3 k0 ` //---- Enter your callback code here -----+ f& X" u% a, z. P! t6 X0 Z* {9 `
9 l5 x; C; O0 V' h% |
1 H8 y" q& u l$ M) d0 t. d- q/ h- }5 U6 I T$ u
Session *theSession = Session::GetSession();" [& a5 ~0 P0 E' N/ |. f0 }
Part *workPart(theSession->Parts()->Work());
8 o& o- s' J. C. J0 [1 P, n Part *displayPart(theSession->Parts()->Display());$ e+ o( c7 ^8 d) p
" P( B- j. ?9 A3 h" }+ a ~& r
: f, J0 u, N/ H; y- M Features::Feature *nullFeatures_Feature(NULL);; M5 I: M/ j3 c% Q2 s" ~1 N! L0 q
Features::EdgeBlendBuilder *edgeBlendBuilder1;' e' E* a0 w. |4 u
edgeBlendBuilder1 = workPart->Features()->CreateEdgeBlendBuilder(nullFeatures_Feature);
. ~/ l/ t5 m+ _4 z& P( c& a) r9 h3 M$ q& S" j- k
; b2 {0 y" U: ~, k$ w7 h4 @ ScCollector *scCollector1;% b$ `2 y; C( J2 _8 _, R
scCollector1 = workPart->ScCollectors()->CreateCollector();& ^1 e5 ~, U$ {' A' O: M
z6 Q! V8 R2 ?& K4 `% u w" Z e% ?5 r; Q1 D3 k
std::vector<Edge *> seedEdges;, {% x+ r" [" B! \% q2 v
9 j5 y- A* o% X+ ^. @2 @ std::vector<TaggedObject*>selectob = edge_select0->GetSelectedObjects(); //获取选择的对象
s1 O& s0 z9 L7 x0 f for (int i=0;i<selectob.size();i++)* u/ c. H: h2 h% p
{# H% ]9 |- k7 E1 _; d
seedEdges.push_back(dynamic_cast<Edge*>(selectob));
, N* R) K3 i9 ]' q0 J* b }
- A6 }% o- L- C" s9 A _; E( ]- D1 D* R
double dia = expression0->Value(); //获取表达式的值
" L2 f0 ^) m! j0 b+ c stringstream DIA;
7 }, t8 E; l, q$ F/ g6 O DIA << dia;
9 X* t; t" |# W7 w0 o' d. g a- g0 F% u9 O$ H+ d& t3 u/ v9 c4 l
) f) O3 v. a9 E! C
EdgeMultipleSeedTangentRule *edgeMultipleSeedTangentRule1;
# v' w! [( Q: |. v: N7 \3 G! T( [5 G edgeMultipleSeedTangentRule1 = workPart->ScRuleFactory()->CreateRuleEdgeMultipleSeedTangent(seedEdges, 0.05, true);
# E) _6 p. r% j) |" l) G! u* i# L3 l5 @5 J2 H: g3 r, v
% i0 ]" ?2 p$ k' I4 T
std::vector<SelectionIntentRule *> rules1(1);9 q( ~0 X9 ^+ o: Q
rules1[0] = edgeMultipleSeedTangentRule1;0 k5 Y9 T4 F" A- `$ \8 i9 d* w
scCollector1->ReplaceRules(rules1, false);% w U" {' x( {3 K8 V' H' ?
v! Q: M* j# }
& ^0 ^( }2 f5 O1 l
edgeBlendBuilder1->SetTolerance(0.001);; i, E! R, V1 h' a
3 n1 L; m+ a- y" W0 k T
& X) D+ o- ]% p5 e3 C edgeBlendBuilder1->SetAllInstancesOption(false);
7 C- B' K$ R% |+ t: H) t6 _" c( y; Z, X+ B' G7 p* f; T5 V; s
. D% m6 ~7 a9 L: A! Y" ~
edgeBlendBuilder1->SetRemoveSelfIntersection(true);) x4 N' {1 t& u1 R4 X) A
% ] k& y0 a) ] z" \3 f: {$ ]/ l4 E5 ]) W8 W9 r
edgeBlendBuilder1->SetPatchComplexGeometryAreas(true);
. w1 A/ a' O* J7 E! g
. J; N4 s" p& r+ m2 m2 A& h1 m" S" c$ N
edgeBlendBuilder1->SetLimitFailingAreas(true);
1 S# C! e2 J6 q# ^8 u
) a6 g/ p7 z2 \; }; F3 \0 ]
" m0 c5 u* h! L2 I- G edgeBlendBuilder1->SetConvexConcaveY(false);
$ w* P! T8 i% ^* T8 i" U
7 t @: C: N) w* }6 f* C# m
p l1 L, @ a* d1 r2 F. ] edgeBlendBuilder1->SetRollOverSmoothEdge(true); k; U+ l! D2 c6 c6 W
( A* u: R1 p0 n0 E! e& w
. D6 q3 K! R2 [1 M* @% _' L0 k+ e1 A edgeBlendBuilder1->SetRollOntoEdge(true);
/ Y `' ], o I8 a+ h& A* }
, Z' W$ n9 `7 u7 X `% s. U) W2 {: B6 v0 \3 {9 g& H
edgeBlendBuilder1->SetMoveSharpEdge(true);0 v: U1 C& J' W. h6 Z& [
) A2 J8 d; p6 a, w* \
0 S6 w; h( K F9 ]
edgeBlendBuilder1->SetTrimmingOption(false);4 q+ ?( f! V1 K" S
. H4 V" {5 o/ b
8 i: x8 o* a% i# |7 ]
edgeBlendBuilder1->SetOverlapOption(Features::EdgeBlendBuilder::OverlapAnyConvexityRollOver);+ ~/ k& l M5 j. \
( L6 U7 V' P/ c, j/ W0 }" _9 i9 X$ T( j
edgeBlendBuilder1->SetBlendOrder(Features::EdgeBlendBuilder::OrderOfBlendingConvexFirst);
' b! w( c- Z4 C' F" e! B1 U) C# Z- F" r4 i2 r# n3 ^/ ]( d
3 o9 [" h/ R8 [5 Y+ w( F
edgeBlendBuilder1->SetSetbackOption(Features::EdgeBlendBuilder::SetbackSeparateFromCorner);
, {' ^( F# L( i+ U$ X3 I4 G0 H, {+ n8 A& l+ ?
: L P7 N* y8 S& }
int csIndex1;
4 e2 J k& L ]" \" `# ` csIndex1 = edgeBlendBuilder1->AddChainset(scCollector1, DIA.str());% O5 p- j9 M+ z; | D' r
c4 }6 w6 q' p7 B- v* w
. \" ^: b" a' ~: B Features::Feature *feature1;) ~+ S4 ^+ G2 y6 x, e" z! z- _* o
feature1 = edgeBlendBuilder1->CommitFeature();
: Z& J$ A( s# G {, e- G9 _6 K: f# j. J" T. y. u2 e
$ c" J- @/ y3 ]: V+ u) X |; S: T edgeBlendBuilder1->Destroy();2 n# t2 }9 j. I# P
! l3 x1 P9 e3 c6 e+ ^, @ }
! _9 n; {+ ^8 r5 r! J' i catch(exception& ex)
7 ~" x/ L1 w, R {
1 V: p) I5 {' h7 z* H; g7 F" R //---- Enter your exception handling code here ----- N) J$ h0 H0 j9 q5 C& R
errorCode = 1;, n7 o) ^" Y( T( n h
selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
+ R- ^. C8 s# O' p) M }* p0 M6 _+ b" n H2 g. C
return errorCode;- I2 v1 | x, u
}
$ F6 X, \; d' I6 e! _. R. @2 `4 N$ [% L) r5 j2 [/ _' X6 x/ w
说明:因为字数有限制,这里只贴出关键代码。7 c2 @& I' p( x- x0 O1 ]& F
5 a) F( s8 j$ U& i% v3 j
% W3 J" W- J: \/ o9 `6 ~; o+ S% D
) w1 U1 `; g6 L& x. u |
-
评分
-
查看全部评分
|