|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
×
2 M4 e1 D$ l% h+ u; y/ [& Dvoid selectedge::initialize_cb()# g. K! M7 J' V7 u% A. J+ H( ?
{
6 x7 b: x3 R+ z0 a try
& B) ^5 W) @) X9 Z4 H {6 [- S. R; u4 i( W! a+ a
group1 = dynamic_cast<NXOpen::BlockStyler::Group*>(theDialog->TopBlock()->FindBlock("group1"));. z. _5 T1 Y6 k4 m
edge_select0 = dynamic_cast<NXOpen::BlockStyler::CurveCollector*>(theDialog->TopBlock()- >FindBlock("edge_select0"));7 ~3 _% ]9 }6 i7 R5 Z
expression0 = dynamic_cast<NXOpen::BlockStyler::ExpressionBlock*>(theDialog->TopBlock()- >FindBlock("expression0"));}. V7 ^% l, i9 r; ^
caTCh(exception& ex)# T8 @" K. T8 s' O$ C
{
- [1 \# q2 d7 c- ?" i$ I //---- Enter your exception handling code here -----
$ r# @ x& Z1 \" _6 [) p selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:dialogTypeError, ex.what());7 I# s, L6 w$ s% r5 _+ Z& O
}0 |$ O [* g( p
}
8 e+ B) \2 d8 r- Z; _" F
& e/ o+ x# f$ j9 o, o8 `int selectedge::apply_cb()+ C4 N% z& r# }/ T# G% W& p
{
/ k- ]" J/ P) z, k" J) g' | int errorCode = 0;
, _% {, w* \$ S5 M8 b( P9 @3 N try* B2 ^# d& D+ N6 T. \
{( ?0 S7 e3 I u, d3 D) N, z; n y
//---- Enter your callback code here -----
* v2 K4 z7 r! I- g2 z5 r" r) @1 I6 _& C+ L+ {( l
+ |$ A: b5 o [: Q, e& \3 \: s6 ~
* R% @+ `7 W" T: S4 [# ]1 x4 y' \ Session *theSession = Session::GetSession();3 f' q! `0 n5 D1 q* D
Part *workPart(theSession->Parts()->Work());& V% v+ o9 c, [# q9 z$ A
Part *displayPart(theSession->Parts()->Display());0 D+ \/ I" ~; e+ k
1 B# b* |9 m% Z f1 |, U1 V( q
4 {. s# S/ T1 o. L8 X s& v Features::Feature *nullFeatures_Feature(NULL);
$ x- F3 [3 ?7 l Features::EdgeBlendBuilder *edgeBlendBuilder1;( u( o4 {3 L, b$ f6 t" `% k7 }. o
edgeBlendBuilder1 = workPart->Features()->CreateEdgeBlendBuilder(nullFeatures_Feature);
: t7 Z1 M$ ]3 g' L5 A. ?: W; s) V
) F4 _2 a$ H6 L5 C) a, ~7 }! u4 J% c0 ]5 s( h$ v7 x
ScCollector *scCollector1;
, F P2 z0 ]* q6 a$ g( ^: M scCollector1 = workPart->ScCollectors()->CreateCollector();
9 n9 M! M, `5 b/ |
. p! u( k& [, c. n7 v: K2 H9 {9 F; ]! F
" A: w* n' ]! }! x std::vector<Edge *> seedEdges;. l+ k2 k3 O: \8 E& Z1 \/ _
1 @; a4 G* d! w, Z6 u0 c8 |5 w7 L
std::vector<TaggedObject*>selectob = edge_select0->GetSelectedObjects(); //获取选择的对象
* l3 a# U9 Z! u# H8 S for (int i=0;i<selectob.size();i++)
9 V* [, `* g' J- t, B8 C T {$ ]3 U! Y- B- f
seedEdges.push_back(dynamic_cast<Edge*>(selectob));
9 j7 j- Q2 N( \6 H g3 H# d }, H# L" N* k% O& k5 i2 S
" q4 e, {' [5 S9 z7 t( k: o; g, ` double dia = expression0->Value(); //获取表达式的值
& ~/ c* }2 F( e1 l# t1 J stringstream DIA;0 _4 m6 R2 u2 I
DIA << dia;" w5 J, G5 ~, n1 u% K# r
# M! J" n; k0 U; Z
5 n1 p& M/ u2 Y6 A EdgeMultipleSeedTangentRule *edgeMultipleSeedTangentRule1;
& _0 d* o1 g* a2 G2 k edgeMultipleSeedTangentRule1 = workPart->ScRuleFactory()->CreateRuleEdgeMultipleSeedTangent(seedEdges, 0.05, true);$ K' D5 l. n' G: Y# a
7 M) U" `6 z: C' u# n: a4 B( M
+ `& d' D/ G$ l' t2 S: q std::vector<SelectionIntentRule *> rules1(1);7 u |/ P0 H5 f1 i' E% c) C& S
rules1[0] = edgeMultipleSeedTangentRule1;2 n, ^3 h. c8 B* X" ]$ n
scCollector1->ReplaceRules(rules1, false);
) |5 ]* ^1 T7 K* }
* V! N8 z2 ~$ C/ a- K2 P. S
: V5 v* f( N# C/ U: N" K2 P edgeBlendBuilder1->SetTolerance(0.001);
' A; o+ ?: ^( i" E6 q: o. ~) E. Q/ }
9 z: }+ H6 t. e
edgeBlendBuilder1->SetAllInstancesOption(false);
! S! K( m F6 m
* k& r* e2 _2 M7 Z5 P/ N/ g) [2 L' e$ H2 v
edgeBlendBuilder1->SetRemoveSelfIntersection(true);
/ c5 D2 a- {8 K
! D- ], `5 w# {
$ _4 n, O# m+ e% w- } edgeBlendBuilder1->SetPatchComplexGeometryAreas(true);- _% U8 L0 [: ~/ x
; C( a5 Q* L5 W( u7 x
* B4 ?8 j, J- |' B- ^2 a edgeBlendBuilder1->SetLimitFailingAreas(true);1 f4 a1 x1 `1 `& @
4 _/ C+ ~, G3 a z
4 ], [% w" C5 m5 N# r7 x
edgeBlendBuilder1->SetConvexConcaveY(false);% d$ b& z* a' T+ J1 g; S: ^4 b
+ ~2 D( X; b& O5 v! V/ Q& Y9 \; B3 w6 C
edgeBlendBuilder1->SetRollOverSmoothEdge(true);
- v$ O, M# d9 H H h
: E5 F0 [! c' ~7 B; O$ P" Y/ A4 i- p! N0 x+ [
edgeBlendBuilder1->SetRollOntoEdge(true);
# w9 F- C6 S+ B* \ ]
% O* d5 l3 Y: v% S' h% {# E$ P
$ N9 O& u" G2 i" d1 V0 ` edgeBlendBuilder1->SetMoveSharpEdge(true); z4 R7 k* R' G' \. e, g. X) e) a
) `# R' O" M0 ]3 E* R4 N- v
9 D( v4 J) D: Q/ ~& J. | edgeBlendBuilder1->SetTrimmingOption(false);
( A2 L# `& X) O3 q# z5 \: F4 k9 ?( }% A$ o& H [
2 N) Q, H& \8 A* L edgeBlendBuilder1->SetOverlapOption(Features::EdgeBlendBuilder::OverlapAnyConvexityRollOver);6 ~! `9 I* h5 U9 |: |
9 e+ X- @: e0 n& ?% B
1 i$ p. a( g' k4 F) c+ c1 G T% r edgeBlendBuilder1->SetBlendOrder(Features::EdgeBlendBuilder::OrderOfBlendingConvexFirst);
' \1 E, }9 v- o; X0 o* h1 b' t" N+ @6 Z- {) F# q* J- L
6 L* _& t* r9 O/ K
edgeBlendBuilder1->SetSetbackOption(Features::EdgeBlendBuilder::SetbackSeparateFromCorner);: P& K3 _( P( k2 _
6 G7 O/ {1 V8 V3 H
: s u) `" O) {4 \, \3 [
int csIndex1;# m2 s) E0 ^% J0 K
csIndex1 = edgeBlendBuilder1->AddChainset(scCollector1, DIA.str());
" b! [7 A+ ]9 l, F
+ x4 L3 A* n* F* {+ y+ l
; h# d8 H2 q9 J9 U- k Features::Feature *feature1;
2 [; c! S/ u& R- V0 t# k8 n feature1 = edgeBlendBuilder1->CommitFeature();
0 i, p( |/ G5 d+ `
+ v8 N' ?# `) y- m
7 D7 ]$ O" M+ X0 h2 ? edgeBlendBuilder1->Destroy();
& r1 W$ E7 l0 i( }9 M7 a* u
3 T4 _5 f9 c5 o! b5 R& j0 t- ] }/ d0 p w% ?1 L! ^
catch(exception& ex)8 t" a0 Y# A% c* s* `
{' B" K. b9 G9 g0 B# X) c3 @
//---- Enter your exception handling code here -----% Z, |2 l& d. D5 U1 W4 m
errorCode = 1;9 N: n, ]+ E, ]" j8 \4 ^+ b
selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());' y H" j5 `$ C* X5 B# }: C# m5 n
}
: V8 c" ~$ |( p' @) N return errorCode;
6 k0 \' H& G) l( [. L+ L}) ?$ Q# f+ g; N) Z# Y
4 h! ^3 u' q3 |5 m
说明:因为字数有限制,这里只贴出关键代码。
. x8 k* x) c. b, m8 A/ ^, j1 h- _$ V) X" \
' ^4 R0 w x; s+ H+ N% _& @! A% y V P! u1 R) s" `
|
-
评分
-
查看全部评分
|