|
|
秋爱
发表于 2015-8-15 09:15:43
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
* |1 b8 n- l. q) f1 v
void selectedge::initialize_cb()* |- Y! ?+ i: R! @. ~9 u
{/ b2 Y0 P3 i$ E7 H
try+ U/ N2 b# Y6 d( I/ A, a% k
{
4 |% `) g& G: A: P* w6 U3 R group1 = dynamic_cast<NXOpen::BlockStyler::Group*>(theDialog->TopBlock()->FindBlock("group1"));
$ V" M3 f5 S" j T edge_select0 = dynamic_cast<NXOpen::BlockStyler::CurveCollector*>(theDialog->TopBlock()- >FindBlock("edge_select0"));9 B: @6 N( K! w. ]9 U9 G$ `# z$ v
expression0 = dynamic_cast<NXOpen::BlockStyler::ExpressionBlock*>(theDialog->TopBlock()- >FindBlock("expression0"));}5 e; M6 s" b/ @
caTCh(exception& ex)
. j0 T; _) p3 S( G- [ {
c2 _8 G! K [, H //---- Enter your exception handling code here -----( a W7 l2 E- {5 [$ W
selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:dialogTypeError, ex.what());
$ c+ a7 f; O |; L }
2 L O6 p9 Y7 ~! q9 \: e}
7 z) z% ]" L) w( u% t
, O7 h% D/ T. s# yint selectedge::apply_cb(); \3 X3 b/ S0 g
{
2 V+ M- x" R, u, {' @8 h0 W6 z int errorCode = 0;
: ?* y6 S0 F2 x, A3 K7 j4 M! ^ try* Y: c0 H2 }. Y/ |( f1 z7 Y% @
{& J. Z# w4 G! K
//---- Enter your callback code here -----
" V6 S) Y7 Y& y ~, o/ ?
, Q$ p3 T' `) V" j* L/ {' s& n6 h. j- k3 ]8 X
2 _$ x% E4 H9 } ?5 c
Session *theSession = Session::GetSession();. V6 h/ N' j! n0 J
Part *workPart(theSession->Parts()->Work());/ k3 I0 a' R0 E% Z5 }
Part *displayPart(theSession->Parts()->Display());& l, _8 \% ~) v o
" R. z6 y8 \6 I- a! q7 Q- f8 F b) Q. Y* H. g9 Z
Features::Feature *nullFeatures_Feature(NULL);
3 U# v# { I4 t Features::EdgeBlendBuilder *edgeBlendBuilder1;
$ @: t* W& i- F edgeBlendBuilder1 = workPart->Features()->CreateEdgeBlendBuilder(nullFeatures_Feature);
8 G, W# ~7 P# q2 o- M; S" |( p
& A+ Y! u* q# j' W$ I3 D; \# h7 A% s0 L7 y4 d5 L
ScCollector *scCollector1;) q( s. K: u5 ^. ^0 v
scCollector1 = workPart->ScCollectors()->CreateCollector();7 v1 A0 @: u, E; c$ n# T- C
# C' z# b' H, \& }
0 q: l, b( E# |: l
std::vector<Edge *> seedEdges;
$ Z* O/ u( B2 t+ B/ g* U 4 t* v5 p. I; T
std::vector<TaggedObject*>selectob = edge_select0->GetSelectedObjects(); //获取选择的对象( c- N' q- C, I0 [7 p x- }# Y. ]
for (int i=0;i<selectob.size();i++)! U( }% P) a( }6 E; J' N
{
2 g: X+ c3 J: u seedEdges.push_back(dynamic_cast<Edge*>(selectob));
1 ^( E ?! p! y2 z( n! \ }& P$ O( s, }7 t) o" ^
8 g. m1 F+ r8 u4 j9 j U: M double dia = expression0->Value(); //获取表达式的值
S& Q: h4 N! c4 }$ K; ~2 a2 f stringstream DIA;" |1 x H; Q0 G* T, B. B5 l
DIA << dia;5 a( w+ @- Q( L8 Y3 a+ E
7 B2 F5 o1 I( \) b$ C$ \4 _! r# T
EdgeMultipleSeedTangentRule *edgeMultipleSeedTangentRule1;
" @6 H: H5 p! |% p- B' K edgeMultipleSeedTangentRule1 = workPart->ScRuleFactory()->CreateRuleEdgeMultipleSeedTangent(seedEdges, 0.05, true);0 ~, x; X; {$ p5 Y% l
& @ I' V+ v! ?
% ?8 O" v5 q, H9 A9 m. X# a std::vector<SelectionIntentRule *> rules1(1);4 H" z$ V& z0 d( e" |+ s
rules1[0] = edgeMultipleSeedTangentRule1;
1 b3 Q- T2 f0 U, h scCollector1->ReplaceRules(rules1, false);% @, G8 W% @3 ]7 h4 l
' b7 h/ y$ } V, l# x2 W7 L
3 ^1 [- F! @: |: D& [ edgeBlendBuilder1->SetTolerance(0.001);: r1 Z9 M; U. h2 T) e L* J
" ^0 w4 n+ A8 X% m
' G. d. e8 }/ T# p edgeBlendBuilder1->SetAllInstancesOption(false);
' c1 z+ o5 `3 r6 F& s6 w8 x1 z. `3 g/ M. z
/ R, X2 b5 a. ~
edgeBlendBuilder1->SetRemoveSelfIntersection(true);
6 {2 A2 Q0 ?. Q( r6 Y, G1 x2 f3 z7 \; ^6 B) {" ~& v8 ~2 M4 N
6 y4 f5 A( q5 g: K( h edgeBlendBuilder1->SetPatchComplexGeometryAreas(true);
) J0 \3 ?# W, ^& F( ` C* O0 `! J' b% T: w
# a$ C3 Z' | d+ ]
edgeBlendBuilder1->SetLimitFailingAreas(true);$ p0 D. x: ]5 c+ _& a( } h3 f
\* [8 M/ a4 r/ C; v1 g% J
% a% k" g+ w z4 p
edgeBlendBuilder1->SetConvexConcaveY(false);; y2 g" s8 s* P4 y* N8 u
" w2 ]( s7 i/ O T5 x! G
: V2 B8 E2 E/ R& E" O5 n edgeBlendBuilder1->SetRollOverSmoothEdge(true);' X, r9 V6 ]. G5 J0 q& T- B) ]( I) z
3 v" a7 g ?( r6 M; v9 o9 N* g$ r& ~2 V8 `: f
edgeBlendBuilder1->SetRollOntoEdge(true);- B$ `" D; G" D1 s+ x! A
( X# p( U ^4 ]
3 o2 \: b; q' K: E# O. \9 g+ V; C edgeBlendBuilder1->SetMoveSharpEdge(true);
) ^+ J% R+ G5 F( G% Q( u
8 y5 K* t; E) d$ L+ n( v7 y
* W& m7 r, P' p4 A7 F! Z Y edgeBlendBuilder1->SetTrimmingOption(false);
$ f$ G# y* X1 c r: g8 v3 ?' I/ _3 n7 ?
( m- _/ Z* U( `* Q( K) \5 ?+ ^& n# o# `
edgeBlendBuilder1->SetOverlapOption(Features::EdgeBlendBuilder::OverlapAnyConvexityRollOver);6 o/ `; ?6 {( K" L
# p- L7 _' q( t$ [# a
/ W, G) L' u+ V; o+ T; E0 ]. p
edgeBlendBuilder1->SetBlendOrder(Features::EdgeBlendBuilder::OrderOfBlendingConvexFirst);
' ^$ B; H4 d7 X/ ?& }0 q7 K$ j9 L* I" j8 f9 @% Q
# }) B5 l9 s, y3 \
edgeBlendBuilder1->SetSetbackOption(Features::EdgeBlendBuilder::SetbackSeparateFromCorner);& z5 O; e8 V6 P( D) E& |1 _5 `
5 e* w$ ?. c H# s5 c" z
2 h0 g0 X, _) h, |& M; [/ e5 ? int csIndex1;; W7 [% c/ J- n6 g
csIndex1 = edgeBlendBuilder1->AddChainset(scCollector1, DIA.str());) K9 M2 h5 s% f6 x, W- F
. @& S5 T9 m# a- u+ t. [
) H, S# ?1 A9 ?( e Features::Feature *feature1;8 B6 f! Z/ m; @' }- d/ s
feature1 = edgeBlendBuilder1->CommitFeature();3 y8 c0 A0 A0 V+ H$ @1 b I: E0 p
Z( a- V0 N" Q+ M, ?0 ~! p
, B- c: G7 s0 k! C r
edgeBlendBuilder1->Destroy();
7 V: |9 e4 t. E. X! J- T. r+ @% W- {. \5 U: I
}
8 H9 a* M: f+ b8 V catch(exception& ex)
% l/ a$ o2 e( v. d {: U4 i; S" K5 v
//---- Enter your exception handling code here -----
. U% j& t4 e; O K! [6 E errorCode = 1;
- ?/ ^* i/ r% A selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
0 Z" f6 j- |8 [, Z" l }
0 N! C! w' w/ y: K* j: c' d3 B: Q3 ] return errorCode;
/ w& [3 U" E& z' b/ @7 P) O}3 O3 F) C# P7 Z
/ ~4 | h5 S- f" s" f( F% h说明:因为字数有限制,这里只贴出关键代码。
' C$ j0 |8 P# n9 j0 L3 @$ s1 e
3 h2 w4 ~6 K5 H6 x' S- T
! \% b9 i" g |( _% r; V/ Q: \* f" B
|
-
评分
-
查看全部评分
|