|
|
秋爱
发表于 2015-8-15 09:15:43
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
9 K+ N3 `6 V8 E5 Z; vvoid selectedge::initialize_cb() A* r/ f" ]) i& F
{
5 H0 i l9 p; D: c: A" M try
/ S8 R! s' V' }) I7 g4 L {
1 I7 D; M+ g u) Y5 t group1 = dynamic_cast<NXOpen::BlockStyler::Group*>(theDialog->TopBlock()->FindBlock("group1")); e7 L1 {$ d! P# M" t
edge_select0 = dynamic_cast<NXOpen::BlockStyler::CurveCollector*>(theDialog->TopBlock()- >FindBlock("edge_select0"));: q! R* z! O1 ?- x S3 X
expression0 = dynamic_cast<NXOpen::BlockStyler::ExpressionBlock*>(theDialog->TopBlock()- >FindBlock("expression0"));}0 b( O! M; C; o" B6 I
caTCh(exception& ex)
, B- j; ]( W* D7 [# B {/ S/ i8 m/ }8 ? y
//---- Enter your exception handling code here ----- }- o+ `. }$ F: }# V
selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:dialogTypeError, ex.what());: Q2 I9 @1 P1 Q" N+ \: T W J
}0 }2 e1 j( @# N, J3 n/ n% P
}, g0 k, a) f W/ L9 f- g
; g; e& {/ G! d1 }8 G7 C! Qint selectedge::apply_cb(), M/ `; J. O }: m# M5 c- j" ~
{* c e8 @; q; v* p
int errorCode = 0;% r. I+ P9 t( q1 x
try
7 }6 Y& I8 b# s7 x! q {# P+ G- b0 g6 p/ t
//---- Enter your callback code here ------ @6 Y" M' M" |+ x ?. C# X# Q' o
+ a, `: c. E, X
/ z0 {$ S, O. s! n; R1 Q5 P
& H, p3 S, [/ u. r i
Session *theSession = Session::GetSession();
2 L X, D( W: d9 V& _4 E/ u- j+ F Part *workPart(theSession->Parts()->Work());
' P$ i+ R3 R, O0 z6 N6 y+ Z3 @ Part *displayPart(theSession->Parts()->Display());) C% k' `1 T9 K. [' _+ [
5 _0 ]) d; v! H5 ] G! H# h5 E
( J+ P9 e/ A( A% L9 b
Features::Feature *nullFeatures_Feature(NULL);) A" d3 a' D4 l$ {' [' m* |
Features::EdgeBlendBuilder *edgeBlendBuilder1;, N# r0 m7 r. G- m: |3 C1 P4 v2 C
edgeBlendBuilder1 = workPart->Features()->CreateEdgeBlendBuilder(nullFeatures_Feature);
. G b j/ X6 q: ~2 b7 n' f% A* T- g3 U3 Z/ c
( t* v) p$ G" B% s* V% j
ScCollector *scCollector1;+ O& z" X2 D+ G$ q" b
scCollector1 = workPart->ScCollectors()->CreateCollector();
" i& D" ?8 T5 Y6 h2 e) }1 K6 N/ O1 {' Q0 y6 k" S# q9 S4 ^
5 C; q9 w2 ?' G. W- [. a$ J2 P
std::vector<Edge *> seedEdges;
+ b. X+ \7 i7 t' U% g ; T6 A- b8 W& ~4 i
std::vector<TaggedObject*>selectob = edge_select0->GetSelectedObjects(); //获取选择的对象
3 _* S. o4 Y+ [+ o$ u* @+ M for (int i=0;i<selectob.size();i++): b7 a0 B0 V% W
{* \$ {0 g9 Y! @' l: e; r
seedEdges.push_back(dynamic_cast<Edge*>(selectob));
5 [" D3 c: V) J- h/ L }* ]5 p. f* p5 U3 E
( S k2 }1 a7 r1 d. r% A5 P5 f: n' X double dia = expression0->Value(); //获取表达式的值& |9 Y# I8 u" K7 h4 y, V
stringstream DIA;. L) ?# i) i2 U) y
DIA << dia;. w+ j: M# H" q; Y& {9 I
; P' y) C+ L' @! R: G. o; r
9 o/ ?6 c5 u1 J4 S1 y; d EdgeMultipleSeedTangentRule *edgeMultipleSeedTangentRule1;
% @6 e+ ~6 C+ a% y: O' N edgeMultipleSeedTangentRule1 = workPart->ScRuleFactory()->CreateRuleEdgeMultipleSeedTangent(seedEdges, 0.05, true);) d' j3 _3 V; X3 l0 p
+ {+ a% z: Y, i/ @
. K2 l, E6 p0 w8 E, V- K' I, ? std::vector<SelectionIntentRule *> rules1(1);
% N* Y7 Q O! J rules1[0] = edgeMultipleSeedTangentRule1;9 N5 _6 B! A" U7 f; M0 k
scCollector1->ReplaceRules(rules1, false);5 ]7 @4 J& l) C
9 ~5 C- Q" {( ~% |1 g, r3 a2 W3 Y4 |4 P# @
edgeBlendBuilder1->SetTolerance(0.001);6 P( y1 U3 f& R% g' a; g) ?
+ B) }! O, ~% G- R1 d3 O4 n/ m- {: N! }% r' G
edgeBlendBuilder1->SetAllInstancesOption(false);2 u& J6 W1 d# m, c4 L
& h' S! P) X5 }- Z7 n4 U$ k
. n6 H) O# e& \( w edgeBlendBuilder1->SetRemoveSelfIntersection(true);
1 c! o% T* \0 ]7 [. g4 Z. X" G- l
$ v# d7 v% P5 ?! N' \! i0 p
edgeBlendBuilder1->SetPatchComplexGeometryAreas(true);
: Z$ x0 m6 i- \" T- L
! N8 k+ }$ \' l
* Q' V# S! Z3 ~0 Q4 m4 u0 g H edgeBlendBuilder1->SetLimitFailingAreas(true);
) [6 q. D0 `$ D9 Q3 Z
E9 U' Y. \ L8 L6 _5 C; @# u8 J" i+ m4 E
edgeBlendBuilder1->SetConvexConcaveY(false);
) K$ ^4 ?, Z% p, a, m. e% w1 l& p; j% @' @1 x# }& e
6 H3 |1 j0 J8 ^" @0 }
edgeBlendBuilder1->SetRollOverSmoothEdge(true);3 q7 [; f+ z- E( o7 }# l$ {2 h: c8 L
5 A( l1 ~) K! v3 ^$ g% ^
! J* P, |* ^$ B
edgeBlendBuilder1->SetRollOntoEdge(true);& H4 F4 S- L' J
) {1 Y; u; T+ p9 K
/ W1 J) M, p7 {8 y8 b
edgeBlendBuilder1->SetMoveSharpEdge(true);
3 G: _. P& v9 s. m. ~
" J H, U0 v' O1 A) C" o$ k5 K3 f4 d) |- |0 y1 Y$ o9 m
edgeBlendBuilder1->SetTrimmingOption(false);: n' p2 D! I* J* f! L0 h
' [+ Y7 ]+ K4 ~+ J$ Q2 i
/ r& {% `! ~' t3 M, t edgeBlendBuilder1->SetOverlapOption(Features::EdgeBlendBuilder::OverlapAnyConvexityRollOver);
7 Z1 L3 F1 W/ P; j
! H" d* [9 X- [# c8 H7 [# Y5 t8 C2 i
edgeBlendBuilder1->SetBlendOrder(Features::EdgeBlendBuilder::OrderOfBlendingConvexFirst);
' r6 m) f1 ?) \
& O8 a: {& f! W0 M `
. J" R. I- E& Q: T edgeBlendBuilder1->SetSetbackOption(Features::EdgeBlendBuilder::SetbackSeparateFromCorner);$ m/ F0 _0 ^' y2 g
) k0 s0 | l0 k8 X1 Z" T
i. S0 Z6 Y& R5 n int csIndex1;
4 ~4 d1 X8 R1 ^4 Z# n csIndex1 = edgeBlendBuilder1->AddChainset(scCollector1, DIA.str());
# @" \2 b9 C" [% g, R& R" M2 Q3 U; s, X0 l" ?
, f0 M6 P% |, ~/ ^$ ^. t Features::Feature *feature1;
0 S' _: o+ @7 R3 q0 y+ d3 }. ~ c feature1 = edgeBlendBuilder1->CommitFeature();' ]' E( t' F1 a0 S- q
8 A: X4 x& C0 p, K* ~" v- ?, {
7 X/ ^) ^9 s0 [: Y$ _
edgeBlendBuilder1->Destroy();, d) ^4 L, [. S, e6 D/ ^; P
" m: z( t1 g2 j8 Z }2 X3 n; H! Y5 J$ A' Z# Q0 ~
catch(exception& ex)4 D4 E; d4 q' M* _
{
6 h& T/ \; ?/ g //---- Enter your exception handling code here -----
8 y$ b6 ?( i: K" y' K errorCode = 1;- l2 m: b8 w5 B" P3 S9 z
selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
9 v* ?8 t( A! ]2 ?5 a }9 {/ `" H* d6 m+ Q2 r
return errorCode;
' a+ f1 z6 S5 A}
+ k. S6 |5 g, }1 p5 N. |' j8 H
" o B. k4 M" o. U! k/ f; l3 x2 P N, q说明:因为字数有限制,这里只贴出关键代码。
! R2 | \& R$ B: I- _8 s7 f
) O: Q5 Y. W9 O0 W2 ?/ o# }" H
+ t, C# w1 P. o
9 C( Y# s+ }6 j9 k4 G2 o |
-
评分
-
查看全部评分
|