|
|
秋爱
发表于 2015-8-15 09:15:43
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
1 i2 C- a2 K: f! B& b0 {! y# g
void selectedge::initialize_cb()
* i0 o& q( ~0 c& I{, z9 c! N! A7 E6 O/ j
try g8 V7 L8 G+ _' P4 K2 E1 l E6 t
{
3 j5 R/ E' U& ~2 _2 ^ group1 = dynamic_cast<NXOpen::BlockStyler::Group*>(theDialog->TopBlock()->FindBlock("group1"));9 J# g. Z e1 Y6 u) X% e5 I. B
edge_select0 = dynamic_cast<NXOpen::BlockStyler::CurveCollector*>(theDialog->TopBlock()- >FindBlock("edge_select0"));
/ e( V4 o) p" O4 ^ expression0 = dynamic_cast<NXOpen::BlockStyler::ExpressionBlock*>(theDialog->TopBlock()- >FindBlock("expression0"));}7 J7 ?, P3 S5 W
caTCh(exception& ex): P6 @% ]' x$ f3 O
{
/ M. |/ O3 m+ b* ` //---- Enter your exception handling code here -----
$ r, u3 H) ~! D7 w$ V) W- Y4 s selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:dialogTypeError, ex.what());
8 {% H3 k1 b+ ?2 r/ Q- I6 @ }4 S+ t& m A- r E, m4 V
}3 n/ U4 y% M7 U( |% f
( ^4 W G: W/ U" f7 @
int selectedge::apply_cb(), Z$ X( P/ q2 V6 d# A* j
{
0 k0 l7 i' w" J+ t) }: n int errorCode = 0;# O+ T# X' @& {. Y2 L8 R) ]
try, ?& S" ~7 U" W+ {# H
{
8 U8 M5 p) \% Y- ~3 B //---- Enter your callback code here -----
8 p2 N% B5 ?8 K, |3 b3 q8 F4 B7 s# z9 i- Q5 K# p z
7 w6 e1 N+ B+ w8 A- Q
+ v/ c0 @, t6 s* \. c5 Q5 d Session *theSession = Session::GetSession();
2 I r1 s1 ^+ C/ N( U Part *workPart(theSession->Parts()->Work());
8 x* p# P4 u. G, M( D1 u Part *displayPart(theSession->Parts()->Display());6 Z6 a* w4 R( D( m0 J
/ u" _3 d j5 m& [( u9 L, U" a* m1 C
Features::Feature *nullFeatures_Feature(NULL);5 H) G3 x+ Y# p1 F3 \: C
Features::EdgeBlendBuilder *edgeBlendBuilder1;
0 P/ P( t: l1 {) L edgeBlendBuilder1 = workPart->Features()->CreateEdgeBlendBuilder(nullFeatures_Feature);0 L+ t2 d7 M+ c
5 B/ A& {" r" W2 H; h; p0 Y/ i9 o& Z ]/ B
ScCollector *scCollector1;+ s; E" N! T0 a$ f* P- f& k
scCollector1 = workPart->ScCollectors()->CreateCollector();
. s9 q( i& o3 @( q3 A" O6 R4 z2 H8 A8 v) k
: j% V: n' \; d* C1 q
std::vector<Edge *> seedEdges;1 J+ \$ s! u+ I3 G# O$ _& @
' ^2 o/ A% v/ l% u0 o$ d1 Z' ] std::vector<TaggedObject*>selectob = edge_select0->GetSelectedObjects(); //获取选择的对象5 z; V; Q* E; I, e, S0 d
for (int i=0;i<selectob.size();i++)) D4 W! h- X; i
{2 T0 f/ G; q" N* k# r
seedEdges.push_back(dynamic_cast<Edge*>(selectob));7 q$ I" D; P* P7 J- U
}2 w- `6 D) c/ R+ q
% |# a7 Q: F0 ~" p double dia = expression0->Value(); //获取表达式的值: l$ _$ z( U9 i/ t
stringstream DIA;
" ]9 q: {7 @7 d ]( v3 g DIA << dia;/ E' ]0 ~+ z- {3 {% Z
1 K* X% R: C/ @ Q4 v
2 Z5 b9 k( R; ]7 D k, {* m EdgeMultipleSeedTangentRule *edgeMultipleSeedTangentRule1;% A* y5 g C- |; g% H& [0 L
edgeMultipleSeedTangentRule1 = workPart->ScRuleFactory()->CreateRuleEdgeMultipleSeedTangent(seedEdges, 0.05, true); H2 S& B3 }( {
, V: m: a% C$ V( B. c! J6 ~
* `' S1 J) l3 ] std::vector<SelectionIntentRule *> rules1(1);
& G& E$ f- l4 ^8 \( a/ R- [ rules1[0] = edgeMultipleSeedTangentRule1;! s. w1 Z* G8 {# i3 f: m
scCollector1->ReplaceRules(rules1, false);
& m- B0 O; G! B; F! u9 U: t* C3 |! C2 n0 t( @( K* `
9 o+ ^7 J8 e4 J7 n5 f; q edgeBlendBuilder1->SetTolerance(0.001);* _; Y W" c" z/ X% F% p( {
( R, l1 b3 N( v8 u+ p/ l
3 n) W% F. X: Z! N9 V3 k% ^" M edgeBlendBuilder1->SetAllInstancesOption(false);
* \- e6 `1 W# t; g3 R
' U# M& Q3 T g5 S9 F2 J0 k8 j9 @( E" y/ W8 Y
edgeBlendBuilder1->SetRemoveSelfIntersection(true);
1 u6 h& b( d; ^8 x5 m" T; B5 q x' }
" f5 l7 C" p% K. B7 I$ e1 M, l
7 t7 d+ c4 F2 q: }' G2 S edgeBlendBuilder1->SetPatchComplexGeometryAreas(true);
8 k/ w* h* N; H0 |+ w; G# `) l, u5 O* a: B9 Q' ~. p
E) B% D9 y4 o" s- S; L7 k0 W0 ^9 l edgeBlendBuilder1->SetLimitFailingAreas(true);: o$ C/ j+ K7 X9 ]
4 z6 L; }' _2 m4 K+ n' q4 ]$ z- f8 C( P
edgeBlendBuilder1->SetConvexConcaveY(false);# H+ p: h# x$ V5 J/ [2 z
2 Z: p. F- Y6 E! Q& o; y# _1 M5 \
" T8 C+ I. N |' L2 C% Y8 ^- } edgeBlendBuilder1->SetRollOverSmoothEdge(true);: R _+ Q) N: d
8 l u! u0 ]8 M% W8 y1 l& N
# l9 {& a% ]% b6 t$ l
edgeBlendBuilder1->SetRollOntoEdge(true);+ a! b' c( N! J( o
5 B; v) n, ^) J3 b% X5 W
; e( D9 `3 U& a edgeBlendBuilder1->SetMoveSharpEdge(true);
1 _" P2 \7 g7 {5 S7 K$ W) V" X
o5 u, D# H1 x7 J
8 N* G% z9 ?- G% h) G- H; A* O edgeBlendBuilder1->SetTrimmingOption(false);! ^+ i' o7 u' D" y9 U
) t X/ M7 `6 F
6 \, o9 ~2 J1 C3 B/ K3 L edgeBlendBuilder1->SetOverlapOption(Features::EdgeBlendBuilder::OverlapAnyConvexityRollOver);
% k! V' @3 ^3 I, V# ?' |5 n% Y/ Z1 M0 o4 U& v
8 B1 x; {* s+ x2 z- K' K edgeBlendBuilder1->SetBlendOrder(Features::EdgeBlendBuilder::OrderOfBlendingConvexFirst);
$ y- w- d% t/ w" i" W. v# k* a4 l3 D' _2 c2 Z
! [) S: W, u# ?, ~ r$ S, J
edgeBlendBuilder1->SetSetbackOption(Features::EdgeBlendBuilder::SetbackSeparateFromCorner);5 \& |. g1 F4 N3 [( g
9 i o' i2 O7 S7 e2 M. c
+ U9 Y) S/ z6 ]9 G int csIndex1;: K% d# r0 |5 S6 R& J. ^: E
csIndex1 = edgeBlendBuilder1->AddChainset(scCollector1, DIA.str());
- \' Y! v$ C) J6 I+ s% h9 X9 u. ^
. i- R: j v7 C1 b
Features::Feature *feature1;. r1 a3 c1 h3 p' {+ P; S
feature1 = edgeBlendBuilder1->CommitFeature();
( z, ]9 @, {, |$ ]: |
2 q. v7 K4 N0 q: t# q
9 q; K' b( \1 |3 O) _ edgeBlendBuilder1->Destroy();
b6 z! y! p$ A! ^& n% T) C& S4 Y
5 ], j- w5 r: q! ] }! X4 n" s; W3 S4 t( d9 n$ X8 u4 y
catch(exception& ex)* U3 V6 J# M& j4 g: V( M
{$ c6 |! S. ?) y% N
//---- Enter your exception handling code here -----
4 w Z A0 n$ A M errorCode = 1;
: {1 h7 W+ z0 U; p, j1 W selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
4 r$ o7 [4 M+ {8 _4 t }
. @3 O0 R4 s) H: |" z* Q& n return errorCode; X! Y0 |' }/ c* r# A! ?5 t9 @. ^
}- T5 i+ R; d: J
9 k5 `2 A; u: |; j4 t+ ~
说明:因为字数有限制,这里只贴出关键代码。' Z3 l) u& z4 Z/ y
* M# P' J: v- F; _6 V s/ D
+ L2 l. N, X3 ~+ R# l3 f5 P/ Q* b" a- f# O- [
|
-
评分
-
查看全部评分
|