|
|
秋爱
发表于 2015-8-15 09:15:43
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
5 K; R# E3 W$ |* L2 O
void selectedge::initialize_cb()8 I J) R: H$ l) w* Q6 i
{
) i# O- R: [, M: i* N1 R0 I try, }/ n+ C5 |/ H- f
{/ ^; z0 [' c& H8 i4 k
group1 = dynamic_cast<NXOpen::BlockStyler::Group*>(theDialog->TopBlock()->FindBlock("group1"));( t% ^( r( q" ?; [% X0 y i* B4 m+ }! }
edge_select0 = dynamic_cast<NXOpen::BlockStyler::CurveCollector*>(theDialog->TopBlock()- >FindBlock("edge_select0"));
' k, f9 a4 L2 D! y3 u% K: n expression0 = dynamic_cast<NXOpen::BlockStyler::ExpressionBlock*>(theDialog->TopBlock()- >FindBlock("expression0"));}/ `) L3 l+ w; {8 U; _
caTCh(exception& ex)4 i5 L# ^6 L, c8 }" r
{
u: K; o7 u7 N# k. [ //---- Enter your exception handling code here -----8 I3 A7 Z+ Y2 H0 l! y
selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:dialogTypeError, ex.what());# M+ Z) s" K4 Y1 c8 f& m" r8 D
}# m ^) G' _ |* X& T2 ], Z b
}
9 G9 a' r. O8 @- }
1 U" ?, B% n C: m2 Q6 y% A+ y0 ~int selectedge::apply_cb()* w) |2 L7 a' O2 D/ F
{
' U) ~0 r* ?" S, W1 Y% S7 M int errorCode = 0;0 x# P# f, j7 n, v
try" O: c1 A; h6 X w5 x y4 m
{4 o! L/ L- F9 x& R. T
//---- Enter your callback code here -----
3 ?/ R& R2 b# U8 d$ z* r; {! P: J4 \: }3 i1 q B. h
1 A5 P w8 M! X6 L
z+ @% t9 ?" ?2 n1 v/ E0 |6 w+ [ Session *theSession = Session::GetSession();
! {: ~3 A) u6 ?! h: @& ` Part *workPart(theSession->Parts()->Work());
/ E( E- j5 t9 d" y5 ^ Part *displayPart(theSession->Parts()->Display());9 Y, j4 i! u/ }4 k9 P( A
" L! j/ L2 X0 P; L, V+ g9 i1 b
0 I! q2 V V% Q4 o# B+ S1 A2 l5 { Features::Feature *nullFeatures_Feature(NULL);
/ |+ A0 }. _9 n- d: a' ~$ P Features::EdgeBlendBuilder *edgeBlendBuilder1;
H' t/ ^- H! L/ k) P$ V) [- Y7 v7 L1 i edgeBlendBuilder1 = workPart->Features()->CreateEdgeBlendBuilder(nullFeatures_Feature);
2 R% b0 Z4 g- c( l
# D; p1 U& B4 [4 ^) X8 h* R7 d5 A1 ]
ScCollector *scCollector1;
8 a! }# M, C1 c* T; e scCollector1 = workPart->ScCollectors()->CreateCollector();
! |+ ?& I/ T/ ?9 `- ]
6 ~: V' t. J) X" ^) j* r4 I5 A# V0 ?' {
std::vector<Edge *> seedEdges;; E6 ], i# K* v7 E4 q& \0 w
* g" o8 T- M! ?1 ?/ N
std::vector<TaggedObject*>selectob = edge_select0->GetSelectedObjects(); //获取选择的对象' x. P( L3 l% K5 X0 o
for (int i=0;i<selectob.size();i++)
/ d$ H+ e2 T9 G7 k% h {
1 I+ ?( [6 h# u6 N seedEdges.push_back(dynamic_cast<Edge*>(selectob));( l6 b0 v5 }$ C |
}5 o6 l- o9 p! Z3 S# h& ~& \. S; Y
; ]8 F6 ]; C. U% V% v( R
double dia = expression0->Value(); //获取表达式的值 T) Z# b& T2 C6 U
stringstream DIA;
) t' E, g4 X4 D DIA << dia;
0 r! }/ Z( H d& M. |6 n
1 ~0 e# S7 U( v) {; R; U6 _/ B$ v. Y( }6 P
EdgeMultipleSeedTangentRule *edgeMultipleSeedTangentRule1;) S* ]" B0 j5 B: ^7 D
edgeMultipleSeedTangentRule1 = workPart->ScRuleFactory()->CreateRuleEdgeMultipleSeedTangent(seedEdges, 0.05, true);
( A: k/ P0 ~* k$ [% ~1 G6 v/ P
: N& D- C( `8 f" v8 Q5 |
, z) O/ t q/ ^; B/ ~ std::vector<SelectionIntentRule *> rules1(1);8 n+ k" R% l' M- ?
rules1[0] = edgeMultipleSeedTangentRule1;5 I8 v6 b+ _2 w, R+ _* T
scCollector1->ReplaceRules(rules1, false);: V0 o. _" b+ r
" u6 n" }3 F0 Q/ c8 {3 K/ I) v
# o7 D1 |, N% ? U4 O# V- s# t edgeBlendBuilder1->SetTolerance(0.001);
) R5 R/ e* M7 O1 O# T1 ?+ l# |& P
2 _4 Y( P" N$ ^
3 r Q: p6 t* i edgeBlendBuilder1->SetAllInstancesOption(false);
) t' w( S* K. |% F5 E# e1 I" `/ U2 x. g; ]8 E# u6 z8 v
$ q6 e& ? W- X' C
edgeBlendBuilder1->SetRemoveSelfIntersection(true);' S' R1 Y! k( q: Z v6 E9 u
8 q7 z% x5 \6 g% a9 W
5 c( z; {% f' I5 r h5 @
edgeBlendBuilder1->SetPatchComplexGeometryAreas(true);3 D: H: G& V# k W( ~& Y
* d, t$ D; d4 A6 Y
" ?$ }* P8 |: V edgeBlendBuilder1->SetLimitFailingAreas(true);3 U7 J4 S6 L1 I/ e* {3 a5 }
* s5 U1 o$ P) h4 z3 Y+ v
4 g7 Y/ b5 q* h+ m o edgeBlendBuilder1->SetConvexConcaveY(false);
+ Y1 w2 y/ d) m0 v. L; h
0 \2 a2 w; F$ \' C" R! A% A+ V) n2 [! V2 i6 C- s9 r7 p* \ O
edgeBlendBuilder1->SetRollOverSmoothEdge(true);" h4 M# l7 L1 b; Z3 N
! w- |; g+ k& _5 o- Y- f
9 O1 {" c2 u* Y* W( m; _8 ~ edgeBlendBuilder1->SetRollOntoEdge(true);
9 l+ F3 J& ?* L3 V `
8 R; A( N. w. x& ~
* N! P" W- n0 G9 J, B3 r A edgeBlendBuilder1->SetMoveSharpEdge(true);
) p8 V( k2 W0 C1 x1 S
' V2 e& u" f9 i- W. b+ l7 `" w4 { d9 B: ]
edgeBlendBuilder1->SetTrimmingOption(false);
5 d0 C4 q' S# \( C1 y# x4 L5 U3 F6 N2 V$ S+ @7 d
% ]8 |" d+ ?' R4 T A' T
edgeBlendBuilder1->SetOverlapOption(Features::EdgeBlendBuilder::OverlapAnyConvexityRollOver);
' S& Y' D! a- J) B# z- {: s/ I: S |# ?
6 r0 ~3 V$ B+ M' }1 x edgeBlendBuilder1->SetBlendOrder(Features::EdgeBlendBuilder::OrderOfBlendingConvexFirst);
% k# B% Z! a7 X) [
8 f0 y* E& C" }7 H1 w7 ?4 b, Z; L( b5 U7 U
edgeBlendBuilder1->SetSetbackOption(Features::EdgeBlendBuilder::SetbackSeparateFromCorner);: V- c( L1 W- r0 V) L
F5 u: u- X0 d+ V! L) A9 K0 m5 v, a6 `+ L, q, Y
int csIndex1;
; [% g, V) [6 K; a' W! ? csIndex1 = edgeBlendBuilder1->AddChainset(scCollector1, DIA.str());
2 S3 ]# L" L; j
' G S$ ^, a/ N
$ x+ p( x9 R: Q+ @. \ Features::Feature *feature1;, m8 Q* f! E- @+ ^0 X' r
feature1 = edgeBlendBuilder1->CommitFeature();8 u: x. }) P, e8 A( o
1 K) I& z5 Z& l& D
& o0 y- _& b* P% l$ F( D
edgeBlendBuilder1->Destroy();
6 X5 K+ O) a/ z$ ?5 T9 w2 E# B& b
& O1 f" L, O2 q9 i" |2 r/ ^9 l }. c5 } u& o, ]. ]
catch(exception& ex)
( O- j- q9 R& I6 {$ g {
4 a" N, d6 P+ Y //---- Enter your exception handling code here ------ f- N, Y4 \' f& ]0 b% v0 k6 Z
errorCode = 1;" h {( {4 L% B. w6 H
selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
# Y8 g, F, u5 R6 Y$ b q( y) ^" a8 Y }
! h5 V8 f3 m; A/ R return errorCode;$ p2 R J( v7 z5 I, g5 R) L
}
) T0 a. F, o" L. x5 T
; }3 f G& S0 _* w% {说明:因为字数有限制,这里只贴出关键代码。
* {; X+ L; K4 U7 O; @- q2 Y% `% C' t+ y0 u
% E) }; N, b& _, l1 z
9 K9 E |4 p/ V- _1 U |
-
评分
-
查看全部评分
|