|
|
秋爱
发表于 2015-8-15 09:15:43
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
. o& B. k4 B$ a- F- [5 u; u1 R
void selectedge::initialize_cb()7 C J- v) ]( M" z
{% e8 g$ y6 m. ]& M" S! d. A9 v9 L
try0 z; D: G" J( E; j3 L
{
1 z8 M* D7 p3 g group1 = dynamic_cast<NXOpen::BlockStyler::Group*>(theDialog->TopBlock()->FindBlock("group1"));% d' ^# k4 {, q! r) B
edge_select0 = dynamic_cast<NXOpen::BlockStyler::CurveCollector*>(theDialog->TopBlock()- >FindBlock("edge_select0"));
3 A" o4 X6 g+ o8 s1 H expression0 = dynamic_cast<NXOpen::BlockStyler::ExpressionBlock*>(theDialog->TopBlock()- >FindBlock("expression0"));}6 E- d" L, |4 L
caTCh(exception& ex)
: D4 h4 V# |) A( N- j {# d7 D0 S0 E& ]5 g4 E& k
//---- Enter your exception handling code here -----
) \0 v* R5 I$ G# } selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:dialogTypeError, ex.what());
3 H4 `* \* j5 i: F4 k }" d/ w$ y% z& Y: Z/ \. v6 C
}
- I5 v# C- s4 F/ D
: E# Z( s: F" o: {int selectedge::apply_cb()
( S8 Q% {* O, e0 c6 N. u{
! q( M3 j6 ~2 d$ V8 z3 _1 O int errorCode = 0;
) ^+ [0 ^4 U: o try
& ?0 s) v$ L5 ~) u {
# z$ `1 k9 F- N6 n- A //---- Enter your callback code here -----1 [: p; v$ C/ j( v& }0 F/ w* f
4 X. O/ y( R5 O/ `% L% u. X
5 X' M, o; w7 t3 l0 K4 b' N i
1 g6 t4 X& a& F2 \4 Y# v
Session *theSession = Session::GetSession();
( r+ M% o+ F% W$ ^ Part *workPart(theSession->Parts()->Work());4 N8 q7 F: `+ `" j
Part *displayPart(theSession->Parts()->Display());4 v; `( D4 N" `0 s& N5 ^
+ V; w' r" t9 A" H& B" {6 |" B5 T/ G, ~2 J
Features::Feature *nullFeatures_Feature(NULL);
8 `/ P _0 H4 | Features::EdgeBlendBuilder *edgeBlendBuilder1;
7 Z8 X' R! l: v( N8 }3 ~( h edgeBlendBuilder1 = workPart->Features()->CreateEdgeBlendBuilder(nullFeatures_Feature);5 o! g1 n1 P- M2 Y
" V; o7 m& g+ C, N) r3 i- p. \% F: c8 L' i- `: y! b6 b6 q
ScCollector *scCollector1;
1 A, S" o% K7 P& [. q8 ]9 ^" H# x scCollector1 = workPart->ScCollectors()->CreateCollector();' J: u" ?/ X7 T3 y- r% G1 D M. N
4 Y; F9 [0 u6 X- D
/ M0 `% e: h" U" p. K9 B4 B
std::vector<Edge *> seedEdges;
! V. [1 q7 b9 [& z' w* ]! I: d( j$ V ) w0 e2 }0 f7 o+ \2 X7 s
std::vector<TaggedObject*>selectob = edge_select0->GetSelectedObjects(); //获取选择的对象
( M1 {; z* s0 i$ o$ i- E3 I" ` for (int i=0;i<selectob.size();i++)
/ i d) N' R* W6 c7 H {
% R8 M' p- l* V* l" ]. C seedEdges.push_back(dynamic_cast<Edge*>(selectob));+ j9 j; C2 R0 k- N7 w# V. z
}
/ G' A( g2 ~: J* O- S! _$ k6 h* Z+ k8 @9 y5 I, z m
double dia = expression0->Value(); //获取表达式的值2 W, s8 K! r' P
stringstream DIA;. W9 H2 ~# ]; A3 Z, i, a% y( }3 Z
DIA << dia;5 P' S- `4 S) c' W
7 T; I! F4 {1 i0 v7 {7 ^0 d6 R( @% u7 \+ J# a d: W, ?$ a1 x6 ?
EdgeMultipleSeedTangentRule *edgeMultipleSeedTangentRule1;4 o* w1 i, z) C+ }+ N! h% w7 V
edgeMultipleSeedTangentRule1 = workPart->ScRuleFactory()->CreateRuleEdgeMultipleSeedTangent(seedEdges, 0.05, true); j m \/ A- a* c, I7 B
5 U- }0 W% A0 m2 d
+ m! r v* K1 l$ b) A9 s5 A/ {
std::vector<SelectionIntentRule *> rules1(1);5 P2 w7 P# s4 r; |; l
rules1[0] = edgeMultipleSeedTangentRule1;
2 h" {' Z5 b- r" V( E scCollector1->ReplaceRules(rules1, false);/ q' k8 g9 P$ c3 {2 V$ {
M# W1 s: ?3 \1 R+ q' _/ g3 K% B5 X% p5 e
edgeBlendBuilder1->SetTolerance(0.001);+ W: l* h# {3 D/ h* {
/ q. v9 E9 ?% e4 d
# V$ g5 e7 ]# `
edgeBlendBuilder1->SetAllInstancesOption(false);7 W' B8 q, k+ z6 s
( `0 A( ]6 M I9 [3 e, w9 c
1 C. I9 u1 U! q; M# M# n edgeBlendBuilder1->SetRemoveSelfIntersection(true);3 D$ @- O; Z) Y: s3 v- ^8 e
% Q M& y: w2 j9 o! h! N
# Y, O+ ?$ P; H% d* c$ Q
edgeBlendBuilder1->SetPatchComplexGeometryAreas(true);: H# T: m; `+ E e- x- Z1 v) z
' o$ O. |9 l2 n) ?' B
6 v% _- o! v5 Z6 m1 a6 I% a( k edgeBlendBuilder1->SetLimitFailingAreas(true);" I( ], T7 X! \& v1 u
2 M4 P$ l* p: l6 o6 C( k' x
0 s% c G+ i1 N9 z: F0 C% P edgeBlendBuilder1->SetConvexConcaveY(false);
; X& F, O8 z" \* }: L$ a; P
9 r3 h- @0 @1 ~5 T/ Y0 B0 D {" ?9 A1 o- z& i/ @& X0 H
edgeBlendBuilder1->SetRollOverSmoothEdge(true);
! @$ m3 u( Q7 b3 M7 W Q+ i8 a
% c' K: \8 X' N2 q% W
: w1 }" y1 K8 _% ] K0 X' d7 [ edgeBlendBuilder1->SetRollOntoEdge(true);
0 D5 g4 S9 K9 o1 u* f
( D3 s1 B7 x% W
1 n: M4 P' i, }' p: g8 T3 ` edgeBlendBuilder1->SetMoveSharpEdge(true);
; u( X* S' \- T& b5 C
' ?% n- A; B( g. W$ X
+ x5 z4 W- l7 a# f edgeBlendBuilder1->SetTrimmingOption(false);
6 L* V4 r( t8 y. N. s' h) }7 O3 I- T. @7 F+ F; K
8 U2 i5 u: w, y+ _3 N5 ^: ~2 R edgeBlendBuilder1->SetOverlapOption(Features::EdgeBlendBuilder::OverlapAnyConvexityRollOver);
- d H* }5 h: B8 o* N' i0 c0 ? I3 |* J$ j `
2 x }+ h$ |3 L edgeBlendBuilder1->SetBlendOrder(Features::EdgeBlendBuilder::OrderOfBlendingConvexFirst);
- d5 d" j+ y& I) r& x. N" _- J6 f, [$ O
" p$ p" ^; r% B- B edgeBlendBuilder1->SetSetbackOption(Features::EdgeBlendBuilder::SetbackSeparateFromCorner);4 A; P8 I/ [2 H- C: ~( ?
7 p# H1 y: V$ O7 X; s! T7 L$ e; \
% J2 w; `5 @! r int csIndex1;; f) l# h+ n5 S: l+ f
csIndex1 = edgeBlendBuilder1->AddChainset(scCollector1, DIA.str());
) I7 e4 V5 [# R& s& ~
) o+ s; U8 s" c0 N, |' ~
/ a' w- Y- v: N0 }7 I4 ^) N Features::Feature *feature1;6 p4 W* G4 n5 H/ C+ Z' ^; H
feature1 = edgeBlendBuilder1->CommitFeature();
3 ~: \9 R9 t3 i$ }4 ]+ K! ]( v. N% R+ E& u T
! d/ q( M, ^& U
edgeBlendBuilder1->Destroy();' X) p1 |% e, ?
a0 j3 c- T" y
}
4 C2 M2 q0 _7 e3 H( n: Q/ ^ catch(exception& ex). \( b" O% M( m! o, V P O
{
5 z% V' ]7 s k+ a //---- Enter your exception handling code here -----
1 |6 O5 X' x% ^5 j1 r$ v8 l Z errorCode = 1;
& ?2 ~6 O1 q) y* } selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
: L/ l' R% Z i8 z }
& G5 _# u) C# S( m0 A6 F Z return errorCode;
) j* Y4 D) S( S) ^- k. |1 e6 c}: X# b* ^3 p; J. E5 Q. D, ^
# t! P ~3 ~% }. s9 R* D, S' Q说明:因为字数有限制,这里只贴出关键代码。' |8 g5 g/ H3 y% [+ \2 h5 R
7 H4 ^# Z/ H# v$ N7 {% Y3 }
0 Y( [' T* W8 t& _2 p. S }7 U7 _" F* `- A. r
|
-
评分
-
查看全部评分
|