|
秋爱
发表于 2015-8-15 09:15:43
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
5 A- K) N. t- J8 o1 j$ _
void selectedge::initialize_cb(). ^! ^1 h$ }- V: k4 s
{
* j5 `- {8 W+ r# e2 z try3 u7 H2 h8 f' N
{
, |8 Q9 R5 N1 }$ T; s* Q group1 = dynamic_cast<NXOpen::BlockStyler::Group*>(theDialog->TopBlock()->FindBlock("group1"));! Y" M( J6 I- W! S7 j. O3 Y
edge_select0 = dynamic_cast<NXOpen::BlockStyler::CurveCollector*>(theDialog->TopBlock()- >FindBlock("edge_select0"));
4 `+ Q% J' x1 `- {6 h expression0 = dynamic_cast<NXOpen::BlockStyler::ExpressionBlock*>(theDialog->TopBlock()- >FindBlock("expression0"));}) s& f" G$ b3 ?# F
caTCh(exception& ex)
# c* O' R- `1 d$ V% E$ X {
3 ~" S/ c% ~& H+ l //---- Enter your exception handling code here -----
2 b I6 |! m7 L' | selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:dialogTypeError, ex.what());9 S0 H9 X9 A& y( R
}
& }1 t& P# L4 E( A}6 @, b1 F6 \, R- }; u
% Z) O: B7 s: P; J9 rint selectedge::apply_cb()( x, m/ J; b5 Y0 i4 Z" g* A2 f
{
* [& [3 A& G; j; ]$ b6 d1 v8 ^* c int errorCode = 0;
2 K, m7 i2 j: q# E- j try
3 U6 c+ D, T/ g- B0 N1 m2 t {9 a' s0 x* ^" T
//---- Enter your callback code here -----/ {. p$ `% |1 R% h h; w' L* x$ ?$ R
4 S+ W$ U4 W. \& @- Q1 P
- }- b6 F2 {; \$ K: _
" ^: `# g% _9 w# R Session *theSession = Session::GetSession();5 C, b: n/ f3 _- e1 W+ Q
Part *workPart(theSession->Parts()->Work());
: `9 U" O* E1 q: R, A Part *displayPart(theSession->Parts()->Display());& |7 X4 m2 i! R- S/ C- w" o1 q
. ]. w% b& G, f: f
. ?* A- x+ I" o3 i! k1 ?2 @) L
Features::Feature *nullFeatures_Feature(NULL);
4 B" `/ [, L. y Features::EdgeBlendBuilder *edgeBlendBuilder1;
) H- a5 U, C% k* p( Z/ n! Y/ ~ edgeBlendBuilder1 = workPart->Features()->CreateEdgeBlendBuilder(nullFeatures_Feature);
% C" m8 N1 W* h6 S! Y7 |9 ]& S! N2 K( P4 H3 t% N q5 I0 Z
* y8 B! \" D# k, ] ScCollector *scCollector1;
1 o1 E6 h$ X, E( b3 x+ @5 s8 z scCollector1 = workPart->ScCollectors()->CreateCollector();
, d9 w$ l' V3 ~% \
% f* {. F5 ?0 F# W% e) C: Y" Z1 S( B- G8 |2 t8 H+ v
std::vector<Edge *> seedEdges;
6 U0 f, T" V0 R% ?8 \9 h 7 H4 A+ h) P# X" Q( c7 }4 q
std::vector<TaggedObject*>selectob = edge_select0->GetSelectedObjects(); //获取选择的对象1 ?& `* C- f1 v0 C6 Q
for (int i=0;i<selectob.size();i++)9 A+ q% L# j s4 k
{9 G6 R2 ?+ C v9 [" ?/ T
seedEdges.push_back(dynamic_cast<Edge*>(selectob));+ Q) b A( v {; B
}1 ?3 i8 E0 D9 J6 p: ^
3 Z- E6 @5 b! p. q6 G+ o double dia = expression0->Value(); //获取表达式的值2 e5 B1 a: i, v- m9 Y
stringstream DIA;" M3 ]1 g& Y( _" E- u
DIA << dia;
) t, r3 I* K! D7 D/ o1 |8 k! @+ f, e, T) |
# S* [! E/ t9 g E, N' T N Z" h' \5 Z EdgeMultipleSeedTangentRule *edgeMultipleSeedTangentRule1;
' z: q1 W) g) T9 { edgeMultipleSeedTangentRule1 = workPart->ScRuleFactory()->CreateRuleEdgeMultipleSeedTangent(seedEdges, 0.05, true);* b9 ?( {5 m; N' U9 P& {0 m5 R
/ H) w5 l0 O$ }5 W+ e, q- Z l
" ?0 Q$ a4 i0 P5 q std::vector<SelectionIntentRule *> rules1(1);9 a7 j& Y( K8 R, ~' |8 Q' b# ?
rules1[0] = edgeMultipleSeedTangentRule1;
; j9 ^1 c# _1 _* A; H scCollector1->ReplaceRules(rules1, false);
2 q( m. O& D$ t" E8 d y; T1 L& V: b3 v2 U. G$ r
8 s4 w" ]( f5 ^! S3 |
edgeBlendBuilder1->SetTolerance(0.001);- e b+ ^4 v& x+ c
7 U% j ` } z- r' ^9 E
" }6 a& v; {7 D. R* T9 ?+ I edgeBlendBuilder1->SetAllInstancesOption(false);
O/ E/ {. ]. W9 h: @
, C- ]7 a( U. `7 _8 A. b$ x' h
0 _7 _" w8 F4 r3 n& z: r, p8 o9 N edgeBlendBuilder1->SetRemoveSelfIntersection(true);
6 y6 P6 f$ V0 q% L( _
' F, @: G' Q$ c* o Y4 ^
1 j% s9 T1 b* ~! w% r edgeBlendBuilder1->SetPatchComplexGeometryAreas(true);
' T+ C$ I1 O3 O$ S$ e R) C
5 d/ w& S' f5 ]
" D/ H! P. l5 }3 h; p# j5 Y edgeBlendBuilder1->SetLimitFailingAreas(true);5 `( r' U6 T7 r( C+ D4 k
" [7 g5 i9 @' q! R/ }; r' k' ~/ a$ q
edgeBlendBuilder1->SetConvexConcaveY(false);
4 h" ^6 [( F0 A0 ?* F- l, M3 V& H6 _3 Y9 @$ e$ O- v4 e
+ z( Z& K4 Z; v* d! L, p. R, | edgeBlendBuilder1->SetRollOverSmoothEdge(true);
i; R- h9 v7 M3 Z: o5 ]; L6 F1 x: g
* X+ r% \7 z7 S
edgeBlendBuilder1->SetRollOntoEdge(true);
; n9 U8 h+ j* Z/ ^/ Y3 O! |$ z
* [) y/ d) R( j" [
edgeBlendBuilder1->SetMoveSharpEdge(true);' y% g- z# T8 H- U6 {
- w) X* G9 E: D1 E* b* D- e% [4 b
, {) ^5 H) N& ] edgeBlendBuilder1->SetTrimmingOption(false);
. w0 F; p- T3 X; [/ ^1 |: M( o' Z! v0 l8 x0 j9 x( N) d
, M$ l( G' t# v0 u
edgeBlendBuilder1->SetOverlapOption(Features::EdgeBlendBuilder::OverlapAnyConvexityRollOver);' d9 A! {; X. W5 ~8 t) _
+ V1 a& ^8 ^5 U0 K/ w' Y
( W7 R0 b& f) ~ edgeBlendBuilder1->SetBlendOrder(Features::EdgeBlendBuilder::OrderOfBlendingConvexFirst);6 E5 m ^1 w( c+ N* N
) T* S/ F# v8 Z5 S) g, L+ ^# W: n1 ?
edgeBlendBuilder1->SetSetbackOption(Features::EdgeBlendBuilder::SetbackSeparateFromCorner);
4 ], j7 m- ~' k! d2 T% t) r' l3 X$ N! W& @+ n% d& S
8 U: \7 d/ V6 T. B4 R! Y int csIndex1;, g' _! |, B' w& q) `9 G
csIndex1 = edgeBlendBuilder1->AddChainset(scCollector1, DIA.str());: u. |& W0 p7 p9 d: J
5 i( D, A; @0 r5 e5 t
! f; S( k7 ]: r. f) v8 c! y6 b Features::Feature *feature1;
7 p0 q" q- \" p# w% j% u feature1 = edgeBlendBuilder1->CommitFeature(); K5 V7 z" M. y% V
, E, _' M) M4 @: q( {! g* }
" h3 `4 a6 c% V edgeBlendBuilder1->Destroy();
7 W# o. D0 A- j4 v2 m2 H5 K4 R4 v9 O" A1 }
}
2 ?( j( [4 e5 V z catch(exception& ex)3 K7 R" s! D# n6 Y. @( r9 B8 o
{
1 a6 P. x% m( T8 `+ R //---- Enter your exception handling code here -----3 S; S: l& F* y# o* ^
errorCode = 1;4 ^7 m8 S0 _, U
selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
. w( g* I" f3 s! i/ J# }, y2 I0 e5 g }
0 n* K& W5 p C% D6 G, f9 J; m" q return errorCode;
! X( |' O& Y4 X9 a}. w7 r2 g0 Q+ z
+ t( \ o: J% Q* x说明:因为字数有限制,这里只贴出关键代码。
! S, s+ Q7 b! e
- d- w' z, ?( j4 w& |3 m$ j8 u/ x& h
2 B0 n6 r s, l' E* b+ [
3 [& s8 O& J3 w! g6 w+ K5 J |
-
评分
-
查看全部评分
|