|
|
秋爱
发表于 2015-8-15 09:15:43
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
. a. h% g5 ]" j' L( s, z v
void selectedge::initialize_cb()
3 [; w6 _% f* j+ `; S{6 D ^, e$ m5 y- @- ~2 ~7 C1 k
try
7 A& U+ u# V$ B {
# V7 O: A( ~9 R3 S9 y group1 = dynamic_cast<NXOpen::BlockStyler::Group*>(theDialog->TopBlock()->FindBlock("group1"));
" @. F4 K2 e7 E c# v% D3 F edge_select0 = dynamic_cast<NXOpen::BlockStyler::CurveCollector*>(theDialog->TopBlock()- >FindBlock("edge_select0"));$ q/ D8 c: K; B t$ e g
expression0 = dynamic_cast<NXOpen::BlockStyler::ExpressionBlock*>(theDialog->TopBlock()- >FindBlock("expression0"));}0 k3 A: u; @% S2 }
caTCh(exception& ex)2 f6 }0 R. E( E: Y7 u) f' a! a
{
& f7 \3 T# L) y //---- Enter your exception handling code here -----" K6 j: B4 b: _
selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:dialogTypeError, ex.what());
7 H5 \3 `& l% Z }
; t2 x B8 h! `, ^# f}2 @+ s8 c7 i0 {) \$ t$ [( R0 l
7 }' Z7 S4 g" s6 N9 s+ @int selectedge::apply_cb()4 B7 S' v0 g. Z7 r+ j0 K, ?4 D" g- g
{
/ x- v1 t p$ X6 G$ G' z int errorCode = 0;
6 B" N; l* W9 t! M; T2 V' F, Z try# r& O; }4 K; W8 p
{
+ @# d; n) N6 b. y0 ?# W3 w //---- Enter your callback code here -----
3 Q5 J, j+ X1 R; j7 R* x' P- c; }# j/ u3 a; q, y
% x; c. ?; R0 ^- p; x6 e' e
. u' f; J' n+ I Session *theSession = Session::GetSession();7 m4 A9 ]9 v) P! N
Part *workPart(theSession->Parts()->Work());
9 N$ t: R7 R8 C' q) b0 s2 d$ \7 _ Part *displayPart(theSession->Parts()->Display());
, C7 g$ a" U8 c2 R% [( p( D* ~3 X
M7 Y$ l3 X ?4 B( {5 R Features::Feature *nullFeatures_Feature(NULL);
* w7 X& x6 D/ h. t Features::EdgeBlendBuilder *edgeBlendBuilder1;
0 i5 G( M3 G, x7 I! o2 u: n: ? edgeBlendBuilder1 = workPart->Features()->CreateEdgeBlendBuilder(nullFeatures_Feature);
+ g, e& g+ @, t5 S, J3 v
; \( D2 f$ O; d' _8 U/ n o6 I \. ]- t- V: q& y
ScCollector *scCollector1;
6 i# r" m1 O4 O& u6 w8 v1 i scCollector1 = workPart->ScCollectors()->CreateCollector();# ?; E/ M& e% x! |6 U0 H
' O; K* D4 Y5 |7 k# W: F
% D c' i2 R# r9 H& r std::vector<Edge *> seedEdges;- Q* L6 n |$ O3 A
# i, @% u' E7 V% s3 F* ~
std::vector<TaggedObject*>selectob = edge_select0->GetSelectedObjects(); //获取选择的对象
: e+ U; \5 B7 S1 u( P% D for (int i=0;i<selectob.size();i++)
/ D0 h( i. N7 O! I7 M& R' N {1 c; z6 R7 o% s0 q% c
seedEdges.push_back(dynamic_cast<Edge*>(selectob));/ J) E* C3 r A' ~' Y- Q
}
* c' D/ ~5 B' D/ o$ Z/ d: x3 r, K/ U9 M: |* R+ i
double dia = expression0->Value(); //获取表达式的值; {8 T9 T. _; m" p! C
stringstream DIA;4 _! a* p, T4 G9 }& W
DIA << dia;
+ c7 Z0 Q% y3 w
5 q: y0 e" @& t+ U& p3 d2 ]0 A6 f& d! W" E% H1 x
EdgeMultipleSeedTangentRule *edgeMultipleSeedTangentRule1;: v, X8 h- v a' @& K
edgeMultipleSeedTangentRule1 = workPart->ScRuleFactory()->CreateRuleEdgeMultipleSeedTangent(seedEdges, 0.05, true);
7 Z6 D0 U' h( _( G' L; m& h
% s/ q5 a' ?- C3 i9 h9 R3 C" S2 U& ?" _# R
std::vector<SelectionIntentRule *> rules1(1);
# x1 _( A# N- B6 B rules1[0] = edgeMultipleSeedTangentRule1;6 E0 q+ l! q9 u( B
scCollector1->ReplaceRules(rules1, false);/ ?* w5 x; o+ |" b) i y- {4 a
% C% t! P- R$ w4 {
t2 ?3 N+ |, p) ^
edgeBlendBuilder1->SetTolerance(0.001);3 S9 w' j( d4 k! K
q4 G. I6 Y+ m, W/ N
1 ~4 }9 o$ ^7 D# z4 ? edgeBlendBuilder1->SetAllInstancesOption(false);
) w; i+ n1 @0 n! L( {3 V: J% k
! `2 g3 `+ [9 L; H1 I! d* \/ Y' Y( f# P( m
edgeBlendBuilder1->SetRemoveSelfIntersection(true);! T9 z/ M& T, Z" x
: K- l3 L0 w- e8 L/ ^7 C
8 X2 I% F4 Z6 H5 u8 k3 V: S6 a
edgeBlendBuilder1->SetPatchComplexGeometryAreas(true);- C5 e* }. ^ Z% z* f$ B8 |
5 w; r$ C9 L% S. T' [
& b% k. H1 }" g, C& O" C9 T edgeBlendBuilder1->SetLimitFailingAreas(true);6 A V- R/ W% E2 b
$ l2 r- U+ O& x7 E- d, @
( y) ^ l8 N+ u {- V edgeBlendBuilder1->SetConvexConcaveY(false);$ m9 \3 \* i3 \' J* _* \: A
2 m% [9 X. q! w& q% c
' e8 c7 R( Z% n1 F& T- g, a2 c
edgeBlendBuilder1->SetRollOverSmoothEdge(true);0 I) w6 U; i# C: R% R$ R% s" I
' ?: ~. _9 x3 [/ H% C* R+ f# a/ ?2 A- H B
edgeBlendBuilder1->SetRollOntoEdge(true);4 v9 }$ L* ]5 M, h$ k9 r* T/ {
5 ^3 Q4 [/ |3 ^
4 \5 W2 V" Q; B6 T. j edgeBlendBuilder1->SetMoveSharpEdge(true);9 U. |# n9 L& f9 G2 h
* y2 n" c5 B9 x. ]) z8 E
. ?8 J) m" z& a, {
edgeBlendBuilder1->SetTrimmingOption(false);' @" P9 V# d [7 x7 g
8 ?8 u9 J! R/ u" L% k2 S8 a% o7 a0 d8 v" Y0 ?+ E
edgeBlendBuilder1->SetOverlapOption(Features::EdgeBlendBuilder::OverlapAnyConvexityRollOver);9 V: A% m; C1 |. q
4 P) n" j. d! G; {& \
) y1 V! {/ i4 V6 W
edgeBlendBuilder1->SetBlendOrder(Features::EdgeBlendBuilder::OrderOfBlendingConvexFirst);
: a n0 T) k$ t, T. e3 W* O1 S2 N9 r8 s( A% [/ X
9 m1 u8 n0 C5 j9 {
edgeBlendBuilder1->SetSetbackOption(Features::EdgeBlendBuilder::SetbackSeparateFromCorner);
, n" L; s4 S& t7 `' b* }
4 x9 G' J. u$ B
% E8 L1 n# k" m, o' d5 P3 A int csIndex1;, p, t7 X) k" o* B
csIndex1 = edgeBlendBuilder1->AddChainset(scCollector1, DIA.str());
. B! H) o+ \, P6 P# Y
/ _. e) X/ k3 w8 C. W( [) m2 R; M1 a) M8 r) u p# O
Features::Feature *feature1;
1 P3 c. V% n8 P- ^8 c' P feature1 = edgeBlendBuilder1->CommitFeature();$ I" L! |, |* Y4 ~
, }/ m$ }- p8 B6 p: q% b
- I! d, y; a9 L6 H7 }8 s& W: b edgeBlendBuilder1->Destroy();
& I& C1 h( x. z' e, `/ n' T# c* ?, ]* ?. u( Z5 n
}$ x! d) g6 @* s8 e7 T- c/ w
catch(exception& ex)3 f H+ ^( X+ d$ p" H4 g0 {
{
* b' I) T' a$ W: ^2 n2 z //---- Enter your exception handling code here ----- S. s$ }6 l9 p8 z; A! Q
errorCode = 1;
$ O/ s' A7 R( B$ Q selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
7 ?& ]& N: n- Y0 K# E }
& d5 v' L2 k& ?9 ]. \ return errorCode;! o/ t) O; _ H+ E
}
! V: Y/ t9 a) l1 f2 I4 r1 H# b1 Q t, ~. K: ]. c3 K
说明:因为字数有限制,这里只贴出关键代码。
! \' {: n1 a* }8 D# e6 l( S% ^4 R. M) Z( D9 \/ y6 b, M3 [
( c5 F1 {. |, I
, e6 d3 N' ?- u |
-
评分
-
查看全部评分
|