|
|
秋爱
发表于 2015-8-15 09:15:43
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
( p+ N$ @9 g( c, d0 A4 Jvoid selectedge::initialize_cb()" y0 f) {, v' v6 ]7 `# E
{
% p1 G% I" n9 B& I3 t try1 q, |% C9 I, d$ I+ K9 @9 q3 a
{' A' Q$ n% C8 I* _- L3 Z) I
group1 = dynamic_cast<NXOpen::BlockStyler::Group*>(theDialog->TopBlock()->FindBlock("group1"));
! I" d5 Y& i3 }- B: a edge_select0 = dynamic_cast<NXOpen::BlockStyler::CurveCollector*>(theDialog->TopBlock()- >FindBlock("edge_select0"));( G) k, N, O' U% D/ W W; V8 l
expression0 = dynamic_cast<NXOpen::BlockStyler::ExpressionBlock*>(theDialog->TopBlock()- >FindBlock("expression0"));}
4 [! P8 B9 S8 u caTCh(exception& ex)
& b5 O1 q+ G4 p n {
( W3 Z2 i, x/ }; P //---- Enter your exception handling code here -----
" @% d" U6 P5 l+ E selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:dialogTypeError, ex.what());
/ f( F9 S- k7 Y/ J/ l }
5 Y+ a- F9 z" \$ b5 x}
; Z6 m) `( g1 A0 a0 Q
! O1 c! M. g! y+ E8 q7 `int selectedge::apply_cb()
, q6 l3 R6 R) ^9 B. F{
& ^( H3 L3 Q; y8 n9 o# u: U int errorCode = 0;
8 L# ` `3 `' B, J x1 y, O0 R try
3 a9 \9 k, D1 k3 K% G {: X8 L% i: x9 T1 q3 g+ B
//---- Enter your callback code here -----
+ M! c f- b2 J+ ?; Q% i
% ^7 e. o& i( ?8 q1 t
6 L( v: m! m9 f! d4 E" @
9 D) @: b& e, K1 M Session *theSession = Session::GetSession();3 ?1 E% ?1 P! @9 _2 y6 i
Part *workPart(theSession->Parts()->Work());
3 r1 B7 J$ U2 Z5 ]6 t- |! |8 L Part *displayPart(theSession->Parts()->Display());
$ `" s1 M8 U. y: A8 J9 q
9 k' f! x$ b( l# X) {
, ]/ l6 ?1 B5 d$ m4 d* X% j Features::Feature *nullFeatures_Feature(NULL);9 e9 s) E/ R3 ^1 _
Features::EdgeBlendBuilder *edgeBlendBuilder1;# C% G: p1 D4 o# b R
edgeBlendBuilder1 = workPart->Features()->CreateEdgeBlendBuilder(nullFeatures_Feature);
( ]% h7 i* K! @- e% D* Z" S% u$ x$ g3 c' ~: V, n
( z6 b# C5 G& W- B ScCollector *scCollector1;: h* v/ j. v# |* X$ j @
scCollector1 = workPart->ScCollectors()->CreateCollector();
9 m( Z& @7 X$ G7 ]( a1 o7 t: i Z
1 J& _# @, E4 b7 N& ]& |. |. P* C1 O3 b$ [
std::vector<Edge *> seedEdges;
# E. c1 G$ C% f! `
1 w2 e! ] E% f- x. ]6 N Q- e std::vector<TaggedObject*>selectob = edge_select0->GetSelectedObjects(); //获取选择的对象9 N4 ^$ w# M; p. s( Y5 |
for (int i=0;i<selectob.size();i++)
' y1 R' g+ i8 N" I9 w/ {# Z8 { {2 i" N8 t: F& H1 ?
seedEdges.push_back(dynamic_cast<Edge*>(selectob));; S4 }+ ]. L1 `2 w# f2 }
}( A( E6 i2 S( ^5 p# B
8 B0 L* D! g4 {1 G0 T8 J4 O' O
double dia = expression0->Value(); //获取表达式的值% O: @3 n7 s, H, X+ D
stringstream DIA;" s9 u8 c% K/ z7 E: V8 g: x- {$ @' c
DIA << dia;
- y' {0 m# A, g! {: c2 D# h. |+ q0 d7 \, I# }5 ]
. u9 p) b1 l7 m) i9 u. w EdgeMultipleSeedTangentRule *edgeMultipleSeedTangentRule1;
6 j# B* @! t8 K. Y5 {% x edgeMultipleSeedTangentRule1 = workPart->ScRuleFactory()->CreateRuleEdgeMultipleSeedTangent(seedEdges, 0.05, true);4 G8 ]5 ^) V6 V8 v$ F. }5 @0 }
8 l d" @1 c# ~" j" \( C
, O9 [$ b# }5 I# }. i; I& o
std::vector<SelectionIntentRule *> rules1(1);7 P9 l% u4 g1 `, L- ^* s- A" A
rules1[0] = edgeMultipleSeedTangentRule1;
6 Z$ B: T& r. g- W" n scCollector1->ReplaceRules(rules1, false);
2 J4 H e( D* ]" B b: r9 O* T9 K) [1 }% Z( R! u! }
, P. {. ^! L( V6 X" n
edgeBlendBuilder1->SetTolerance(0.001);3 f' h8 p( l) V5 [6 H
: @+ y$ ]! Y+ J" @. }
- |! G# h( S( V0 x! A1 I
edgeBlendBuilder1->SetAllInstancesOption(false);$ R- L8 `! D4 T* U
0 t8 A( ~; F' E6 y& e3 U( g8 o: @6 y6 U$ v/ i0 f
edgeBlendBuilder1->SetRemoveSelfIntersection(true);
- O" r% D- Q8 B$ W' v, X4 P- ~$ [+ n' Q; {
# I" t# z) s4 T( F0 c: v: [- }
edgeBlendBuilder1->SetPatchComplexGeometryAreas(true);
( F" g# C3 p$ L. W! l* K
: V7 ]1 \$ B- _8 U, \ W5 X/ M3 ~2 a& b8 o0 C* j/ c
edgeBlendBuilder1->SetLimitFailingAreas(true);3 r# e9 L7 q$ J0 l& t: r
1 `1 C% W9 F% K( m! h. V K6 I3 @- @
2 O1 m5 }; }& `# a3 o6 k edgeBlendBuilder1->SetConvexConcaveY(false);! g3 }! S9 l& S
" U, j2 K/ L1 S3 a2 y
- A) Y6 b/ l5 T. A* e4 Q edgeBlendBuilder1->SetRollOverSmoothEdge(true);
/ I4 I" Y1 x5 M. l* x. [4 _: \
v4 O% A5 `; v+ X
2 `- Q8 g; B$ J2 m. V+ A3 q: V edgeBlendBuilder1->SetRollOntoEdge(true);' V$ z3 [$ S \% ?
Z" l- w& B% `: [: l' ~8 m8 i2 }) J$ L9 l* \
edgeBlendBuilder1->SetMoveSharpEdge(true);
% t% J# Y& [& |+ c" t' n& X# \0 ~' I/ G7 |# g; C+ I8 b
8 K; c) q4 B2 [- r4 n
edgeBlendBuilder1->SetTrimmingOption(false);
o7 w* @8 ]& S8 _/ ~- X3 E% R8 M" U1 Z% N2 U5 _( E9 b
}% z6 C# t7 l edgeBlendBuilder1->SetOverlapOption(Features::EdgeBlendBuilder::OverlapAnyConvexityRollOver);
- u" |" e9 o6 L2 {2 u* e! U5 Y! d7 H/ ]
* z0 o( q3 U6 W0 t' Q edgeBlendBuilder1->SetBlendOrder(Features::EdgeBlendBuilder::OrderOfBlendingConvexFirst);4 S$ v H) l) K) |+ i- T
8 G$ e& V" w7 B7 P- A
8 j. W, t; q1 ?; k edgeBlendBuilder1->SetSetbackOption(Features::EdgeBlendBuilder::SetbackSeparateFromCorner);
& j# O+ c' t/ b) S& `/ e0 `* H: Z" \( Z& T
5 J" W5 X4 E; T; o$ o! Y& q
int csIndex1;
8 p5 D2 k! R: H. w csIndex1 = edgeBlendBuilder1->AddChainset(scCollector1, DIA.str());; j& |1 A3 w! ]/ m# u6 b# R% w) I
! N+ x3 w2 H" c2 s y$ u, a P8 j/ {+ Q4 Q7 Y T. m* _
Features::Feature *feature1;5 D% a" `4 b/ C, a
feature1 = edgeBlendBuilder1->CommitFeature();9 v/ \& O, N# N' f5 U
3 ?) j5 W9 m& g7 e4 N
/ j- U0 W J' l7 g/ Q edgeBlendBuilder1->Destroy();& D" M f$ h) ^ T& S2 M! N+ L( U
% c8 G: Y/ G# l( |
}
0 x. [+ }- N3 u: [4 K6 G. V* K* | catch(exception& ex)- c& L1 z* @" L1 J
{
2 c8 r6 ], h! J m6 S. Z //---- Enter your exception handling code here -----
' H( ~/ l- F! R/ A7 T errorCode = 1;
) c: |& v0 F6 W6 [7 Y selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());' f) f; C' K# i" M6 \, Y
}' @1 v0 y; x+ P6 J
return errorCode;- j6 z$ i3 t8 b4 F; k' c+ ^
}
7 |7 _! t: Z) I6 c9 k- F+ B. h! }9 B
说明:因为字数有限制,这里只贴出关键代码。
" Y7 f/ L5 \) `" }. [& p/ X8 x$ A; m& s
/ @" j, |: }+ H! n. z; _7 R
/ S9 p) V# y) j" q" w6 t4 [% z# Q
|
-
评分
-
查看全部评分
|