|
|
秋爱
发表于 2015-8-15 09:15:43
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
9 G; ^2 F% Y! k H' R
void selectedge::initialize_cb()" X2 I- F& k! ^% L0 z: a
{+ o! x i) Q% @- M
try
8 d9 @6 M# Y3 \: A6 m2 t {8 a# O, g- o1 ~7 Q$ I5 H4 f
group1 = dynamic_cast<NXOpen::BlockStyler::Group*>(theDialog->TopBlock()->FindBlock("group1"));
4 B) |- L/ w& N6 A6 S edge_select0 = dynamic_cast<NXOpen::BlockStyler::CurveCollector*>(theDialog->TopBlock()- >FindBlock("edge_select0"));3 c: a) J& `: n9 i1 {
expression0 = dynamic_cast<NXOpen::BlockStyler::ExpressionBlock*>(theDialog->TopBlock()- >FindBlock("expression0"));}
6 X0 ~2 W4 [- P- ~& t2 R caTCh(exception& ex)7 u# o3 H" Z- ^( z! A* k$ H
{
' \9 u( i* H7 l" K+ A //---- Enter your exception handling code here -----' x3 _9 u/ f' r, L1 f% w
selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:dialogTypeError, ex.what());
6 I+ i% G8 d4 F( }/ S: F7 g0 w }
- I5 U. z" R' X1 }}& _( J7 P4 n- n5 z" P7 F
+ C) X& O7 u* }$ G ^int selectedge::apply_cb()" h8 p0 l% H; W. u. @# e4 @. g
{6 v7 Y0 ~2 Y- Y
int errorCode = 0;
# c% [# J- e6 ]) z0 j try
7 i2 C2 J) R% {3 a9 M {, w' ?5 x! ^" u/ ?5 x, ^
//---- Enter your callback code here -----$ ?8 A" T& i" z: H9 S( W- p
6 c6 v$ Q3 [) L4 D1 ] N. ~
* q. ~1 e ?7 s% o& Y6 D$ q! p7 p1 K; Y
Session *theSession = Session::GetSession();
8 j- `# Q! K$ q9 b4 R Part *workPart(theSession->Parts()->Work());
0 L. v0 I0 k/ I$ C Part *displayPart(theSession->Parts()->Display());! [) I" q+ } D+ ?
4 r1 z* |. b0 A2 `3 S7 o! S( ^; N0 i! A! _2 l! \
Features::Feature *nullFeatures_Feature(NULL);7 {+ t) |3 _" I
Features::EdgeBlendBuilder *edgeBlendBuilder1;
7 ^1 i# y e/ J0 K& q. C9 g edgeBlendBuilder1 = workPart->Features()->CreateEdgeBlendBuilder(nullFeatures_Feature);
4 z5 T& Z; ?* y5 ]1 C% [: O
' T f6 ~- k9 r H1 P) k* h3 V7 `
& I5 Z) U) E$ _ ScCollector *scCollector1;
8 r& E: |0 o" a0 g scCollector1 = workPart->ScCollectors()->CreateCollector();7 _7 W$ @( a6 _; u. X) b
# t7 V% X+ \0 j9 g: ?
$ W6 a/ n+ ~% B$ n
std::vector<Edge *> seedEdges;
/ |/ {! w, P6 ~3 ~$ t: U
$ ~: z$ {- [( ` std::vector<TaggedObject*>selectob = edge_select0->GetSelectedObjects(); //获取选择的对象6 {2 f0 ? V* L: F% B
for (int i=0;i<selectob.size();i++)) [2 J' n2 X' P
{
3 Y S, P4 W9 X# x% V- j seedEdges.push_back(dynamic_cast<Edge*>(selectob));
. B/ y: n% V% n! R }7 l, v! H# w1 q: V6 I0 ~! \0 D& n
. |4 Z7 |1 @# X9 V S: f double dia = expression0->Value(); //获取表达式的值
- V2 l# w" b; u stringstream DIA;3 i" U9 X9 Q1 D: H" C( v4 y- g
DIA << dia;
( ]* x, a2 _ Z$ F, j: L# N7 J6 e- E: m; y0 E3 [) l
6 W: b8 m4 G; {5 q( o1 r/ Y8 |5 k. b) B
EdgeMultipleSeedTangentRule *edgeMultipleSeedTangentRule1;
$ R# X1 D2 o1 G edgeMultipleSeedTangentRule1 = workPart->ScRuleFactory()->CreateRuleEdgeMultipleSeedTangent(seedEdges, 0.05, true);
2 m% h1 H5 R5 N6 b' y* L! F0 |9 N& L! I7 c
( r* n- a- a6 X std::vector<SelectionIntentRule *> rules1(1);
9 @+ N8 k5 W1 k4 Z, c# m rules1[0] = edgeMultipleSeedTangentRule1;, x9 A& J- Z0 c( A5 x
scCollector1->ReplaceRules(rules1, false); x) V* R: s' J2 Z. H
' X' ?& t! V6 r4 r- j
6 a% c d9 W: g
edgeBlendBuilder1->SetTolerance(0.001);( `) _' l0 e$ A6 Q& Y1 |8 r: T- ]
5 l( {% M! T z
0 R# D: v; S2 w+ Q& C2 f edgeBlendBuilder1->SetAllInstancesOption(false);
. R- m. n6 T) E; n
u5 m$ X1 Q; Z; ^% c% W7 y6 C' c6 j+ E) W
edgeBlendBuilder1->SetRemoveSelfIntersection(true);. t# o7 W' |7 F" i, F
8 Q- j( {9 {0 N2 [% ?7 }2 o. x* v! h% P
3 N: J6 g+ X/ E9 [4 q! S edgeBlendBuilder1->SetPatchComplexGeometryAreas(true);
' R: e# G" e; e4 |) x; w6 D& Y0 u/ Q5 {6 r1 g' c1 q* ?
" o! P% a* t' n$ `; |) _+ x+ C
edgeBlendBuilder1->SetLimitFailingAreas(true);1 j" l4 R8 L2 A- O! Z$ H1 e
" i% N) g3 ~6 t* q( O
9 H. m, @( Z1 X' u4 }
edgeBlendBuilder1->SetConvexConcaveY(false);
- I7 m6 A) o% z7 {: `
' t: m; O1 e4 Y- w$ I) k! \7 R
" V9 P5 c9 c& m7 o edgeBlendBuilder1->SetRollOverSmoothEdge(true);' }4 i4 D) N0 D
/ ~9 v2 _6 e1 c& h: H: V( P! b$ I0 F. T) t
edgeBlendBuilder1->SetRollOntoEdge(true);* g. x& N$ N: n, v* F0 o
0 U7 l4 g( g+ k# L4 G, s, H8 z
. W3 Y' t8 Z6 c. M/ s( x! t
edgeBlendBuilder1->SetMoveSharpEdge(true);
" Y# ?7 [% P7 \& Y- Q5 g: a2 N4 P P3 m J
$ N. w# P. R! q6 w0 @ edgeBlendBuilder1->SetTrimmingOption(false);3 w: X- j8 x- d# r+ t j
) s: [3 ~; B0 {* P9 o" x
% m# g8 G& G# Z9 U edgeBlendBuilder1->SetOverlapOption(Features::EdgeBlendBuilder::OverlapAnyConvexityRollOver);
3 h5 P4 J K2 [* F& m2 d
& Z Z9 k" C8 e+ L. U+ R. ?* z! n7 @' j% X6 |9 i" g4 G5 Y
edgeBlendBuilder1->SetBlendOrder(Features::EdgeBlendBuilder::OrderOfBlendingConvexFirst);; X: s1 I' @8 W% l) ]8 E) `
2 ~6 ^1 k" z0 N5 Q% D( d2 t+ n* i
+ K9 b& c1 k3 i5 v edgeBlendBuilder1->SetSetbackOption(Features::EdgeBlendBuilder::SetbackSeparateFromCorner);( c4 w& x% ?# e0 R; ]0 w3 J
0 S y- F5 l0 ]! D
& c* c, u- h/ h int csIndex1;7 Q, X- ?9 D) y* F% _ [
csIndex1 = edgeBlendBuilder1->AddChainset(scCollector1, DIA.str());% e+ F* O9 d! H- @
) V, [3 E9 X3 E5 ~- M9 n! e8 e# r+ d
Features::Feature *feature1;$ Z, J& T1 r! I1 h
feature1 = edgeBlendBuilder1->CommitFeature();' w# p& [9 Q( t1 ~, R A
9 b$ m7 g* ~8 ]: |9 g( u5 K
. m# I, l, u$ s8 \ edgeBlendBuilder1->Destroy();
. y0 G' M4 g2 `5 l3 F' {" Y
" m' Z5 Y h. o& Z7 p }* M0 P/ |9 `7 a
catch(exception& ex)
, m2 T' H' M, H2 [6 M {
2 d" s F# i$ W //---- Enter your exception handling code here -----3 F+ X" v% m0 N7 {# S
errorCode = 1;. c- L" f( q; H% X5 _/ W. {& \; y
selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());5 H M4 |/ q) b: @
}
1 W" z F; @" R, y8 B return errorCode;
( {0 ?" v3 S" m# [8 x}
# O# w) d: m) s$ [" t) Q, C2 z, {+ N* Y" ^) ]: \
说明:因为字数有限制,这里只贴出关键代码。
( n) C( |5 `; R( U0 `
. [* ]; f. o4 d: o. c5 w' a" y# W! l& j! |
# z x0 L1 `5 G" F
|
-
评分
-
查看全部评分
|