|
|
秋爱
发表于 2015-8-15 09:15:43
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
0 A3 l1 A2 j0 L& Q, ` J% evoid selectedge::initialize_cb(). ^. e4 E0 j7 o7 |/ `7 |
{
- `. b% V4 C. S# a9 c0 P try+ {' X5 ^2 n* j# ?6 Q" ~6 y, C& O, @
{* [# j( Z; b3 W* u6 V7 k( R
group1 = dynamic_cast<NXOpen::BlockStyler::Group*>(theDialog->TopBlock()->FindBlock("group1"));
G3 S) g9 y7 K: ]( }7 u7 K edge_select0 = dynamic_cast<NXOpen::BlockStyler::CurveCollector*>(theDialog->TopBlock()- >FindBlock("edge_select0"));$ w- S2 u! e1 }) q
expression0 = dynamic_cast<NXOpen::BlockStyler::ExpressionBlock*>(theDialog->TopBlock()- >FindBlock("expression0"));}3 R0 M1 {: ]& @9 x# W4 P
caTCh(exception& ex)
`' e7 e+ V; r* _* ~ {/ T3 Z: Z1 n( k
//---- Enter your exception handling code here -----
" w& t# I6 C! x+ e selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:dialogTypeError, ex.what());. P- H( l! ?6 T% T6 \" N! B
}
/ I9 c# w/ D; a; \! f) ^8 }, l}
) i+ m9 L' p- e5 B2 h. P" O* v: P6 z0 ]4 r; d1 X
int selectedge::apply_cb()
: w/ a) }4 F, k: v0 a{
" }: A" l$ m+ B- c9 ?2 g int errorCode = 0;
3 |/ e: B% E& N0 {# V try
7 I# o/ L5 d! R3 Y8 }9 ` {
; |3 H% Z* o7 y6 J( t# r6 X, I7 x, l //---- Enter your callback code here -----9 J4 }% A- @ ]; s: j) F
, t5 @1 f l7 x% `8 _7 `/ b0 ^1 X- A9 a* N" q, B0 a$ E: e
# c! w% @# c O6 o: R8 z# H
Session *theSession = Session::GetSession();
, b1 P9 o0 M( n( b+ o* i Part *workPart(theSession->Parts()->Work());) d$ m! Y9 S6 Y, Q9 A3 S
Part *displayPart(theSession->Parts()->Display());
& T( q# S! P! q% I6 b
0 m A; Z# G O+ `+ T7 q/ ]4 d, J
Features::Feature *nullFeatures_Feature(NULL);
% m# _2 q$ {- w7 |) X0 u2 {7 }6 t Features::EdgeBlendBuilder *edgeBlendBuilder1;1 I8 M: Q! E+ A
edgeBlendBuilder1 = workPart->Features()->CreateEdgeBlendBuilder(nullFeatures_Feature);
: O2 W" R: d0 z1 f/ T2 s6 B- a3 P. C1 P( D
* R. G3 t6 D0 u" n# K/ @
ScCollector *scCollector1;% i7 e. I( _- U2 t: ~% Q9 R- P+ G
scCollector1 = workPart->ScCollectors()->CreateCollector();, P( Q' r3 l" I* i4 }9 ?6 Q
1 q: n1 c4 o5 c
. F( I/ I i2 M( o+ t! `
std::vector<Edge *> seedEdges;$ Q7 m" L7 E( t, C3 {
- q2 D4 J4 @6 w+ W
std::vector<TaggedObject*>selectob = edge_select0->GetSelectedObjects(); //获取选择的对象* j2 P! Q( {3 U# W# {
for (int i=0;i<selectob.size();i++). |: y$ Q$ \5 w3 k4 Y( x3 ]) v, F
{4 N+ ^$ D( x6 T+ ^0 V; |' Y
seedEdges.push_back(dynamic_cast<Edge*>(selectob));7 f& Q9 k$ M; N) Y) ~
}
/ z0 E( q1 N `* J4 p5 m4 r
# Z: T8 p# w# }: ^) r; u3 i4 o. l double dia = expression0->Value(); //获取表达式的值
5 |. N/ R: O8 z' W- e3 l T stringstream DIA;* P2 g# s0 z& M7 u* `0 P/ Z
DIA << dia;
" |) r* W* }) }$ g( E E& S/ V* c/ q: i0 e* a* r2 r
6 r$ u c% d+ y; _; p1 @& W% |
EdgeMultipleSeedTangentRule *edgeMultipleSeedTangentRule1;
! U8 j ]! {: o" r _$ } edgeMultipleSeedTangentRule1 = workPart->ScRuleFactory()->CreateRuleEdgeMultipleSeedTangent(seedEdges, 0.05, true);
! g+ A" t9 T8 R, y$ L/ g: \; w! u8 e: ?2 \- d% @
% z$ d, x1 B% l3 E/ y% V, S
std::vector<SelectionIntentRule *> rules1(1); b/ D, b5 Q6 c# B- N" h
rules1[0] = edgeMultipleSeedTangentRule1;/ D# ? \1 I" B) w( V( k& ~
scCollector1->ReplaceRules(rules1, false);1 ^- u, A5 \9 R5 U9 t
( N. s$ j- o# i7 F8 b; R$ v
# L# f) H& g, h# n2 | edgeBlendBuilder1->SetTolerance(0.001);* l+ P6 V3 v5 J1 F, w! N; T
) l1 _2 U, p; c! N
4 {4 }1 w8 a" h8 f4 U) R. U edgeBlendBuilder1->SetAllInstancesOption(false);+ x! n- }. g+ U# r9 U4 y
1 B/ C0 a# q3 W2 \5 ^
. M% ~# c5 t$ d: q2 P edgeBlendBuilder1->SetRemoveSelfIntersection(true);( F& N/ G) [& n; ~) A) T* \
3 V0 p0 n1 o1 r- ?% Y3 M
, u% x; v9 d/ W) [# p9 | edgeBlendBuilder1->SetPatchComplexGeometryAreas(true);
: Y0 q8 R$ U, e! W
% k/ }$ i: r" p ~$ Y
3 I- O. |) N# K3 h% m% C9 h edgeBlendBuilder1->SetLimitFailingAreas(true);3 h$ j+ ?) o7 o: Q4 Y2 ^! o ~
K e% O8 O1 G0 S) }/ y6 I$ j7 A5 `
6 w" ?5 z* K! V
edgeBlendBuilder1->SetConvexConcaveY(false);
( h( n- z3 E+ k# T5 V3 e+ C; b& t. q$ w
% O# d2 u9 @' k- k edgeBlendBuilder1->SetRollOverSmoothEdge(true);+ U$ s" o2 Z5 t% [8 T& B Z3 F
8 y& `; f7 l: c1 p2 [) J& O- p* ^
edgeBlendBuilder1->SetRollOntoEdge(true);
: U% d; B* }4 e3 h& l2 y! ?3 i% U9 u* z
' ?* k! q3 G. u1 i. } edgeBlendBuilder1->SetMoveSharpEdge(true);
, q8 M- R- ?. U) T
& w$ s+ A. b, s: o3 ~1 @4 G# n% S9 S" W1 a R2 a
edgeBlendBuilder1->SetTrimmingOption(false);2 p* s; z$ p! I2 b. g
7 o. ]' h! s* y* D% N3 T" r
1 \ V3 ]+ h t C, r
edgeBlendBuilder1->SetOverlapOption(Features::EdgeBlendBuilder::OverlapAnyConvexityRollOver);1 `6 K! O7 A* B8 h4 v7 e' i7 C6 l& Z
+ x- d$ S! x, C6 m4 A* `
3 t3 ]/ s' K! g5 ` edgeBlendBuilder1->SetBlendOrder(Features::EdgeBlendBuilder::OrderOfBlendingConvexFirst);& j, I4 e0 V& h. D
( K% L1 N) q+ {, \
: G0 @) T. D2 r1 P8 Y. d: H edgeBlendBuilder1->SetSetbackOption(Features::EdgeBlendBuilder::SetbackSeparateFromCorner);
: m$ H' v& p; i" h! g) i3 X+ c5 s
! N W5 h4 J( L6 s/ o5 _
. B4 V( z8 F. R: Y int csIndex1;+ m1 t8 B4 y" ~' c8 Y
csIndex1 = edgeBlendBuilder1->AddChainset(scCollector1, DIA.str());: a1 s, @/ D0 z4 f/ V D: \
/ _: P, b& S. s x: @& z1 S) ^3 D7 C: O1 Y
Features::Feature *feature1;
" v4 Y4 u- [9 j* z feature1 = edgeBlendBuilder1->CommitFeature();1 x, j/ f) I$ W
5 X$ B' H* \1 q$ O0 y3 p3 {& M+ V8 T% C3 W: Y
edgeBlendBuilder1->Destroy();
6 U, i; l6 I9 N% x I; j1 `2 g2 n& x; g ]% j- ?5 ?
}1 m$ M7 |1 L/ Q, \7 C
catch(exception& ex)
$ j! e0 w: N+ P1 M% w3 ` {2 ~5 k" d+ t# [
//---- Enter your exception handling code here -----
6 R) M* b2 R# ~% e! | errorCode = 1;
5 o! _4 @3 S4 E! d. T- I" S9 R selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
( D% N# W9 [$ ?4 g: c2 v }9 N" H7 k5 Z3 s) H7 L. k3 ? m
return errorCode;
& b$ ~: P. f- U. }% q5 y}
" P3 a' A- ?4 }! E# I7 D2 E! C
$ {/ D, U& Q q6 u/ J* @+ W说明:因为字数有限制,这里只贴出关键代码。
6 I& l' |1 B2 t0 L
% H/ H! w4 j9 B( H9 d
" E9 M, e& M+ |% J- }, p; `
4 ~1 v4 }- l" V d1 s: J, L% n8 y. F |
-
评分
-
查看全部评分
|