|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
×
& |+ |" b& F7 D" Avoid selectedge::initialize_cb()
/ D) L, s2 @* d- ]{
9 C' L) J2 b/ ~, I1 h3 N$ y try, h5 e0 v p/ F3 O
{4 W7 [+ t/ B5 c9 H% l0 J( e( c
group1 = dynamic_cast<NXOpen::BlockStyler::Group*>(theDialog->TopBlock()->FindBlock("group1"));
+ n/ ~$ Y+ A6 K% h0 H7 U edge_select0 = dynamic_cast<NXOpen::BlockStyler::CurveCollector*>(theDialog->TopBlock()- >FindBlock("edge_select0"));
: D+ r% M; s2 `3 M" | expression0 = dynamic_cast<NXOpen::BlockStyler::ExpressionBlock*>(theDialog->TopBlock()- >FindBlock("expression0"));}% Z n3 t' c3 W; _
caTCh(exception& ex)
5 i f2 m! {0 u, R4 W {; |: U" J8 f7 j
//---- Enter your exception handling code here -----
9 Y5 C0 [ S( W, W d selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:dialogTypeError, ex.what());$ Y- R+ A/ h+ |
}
- Y; G$ U# e7 [1 D$ x- T- T}
& y! N% B" [0 e) L5 z2 Q" o$ Y+ h; n1 }" e* R
int selectedge::apply_cb()$ p+ ?& y4 Z' V3 `7 h
{
. T' d! B3 V* f% J3 i9 Q int errorCode = 0;
' D9 {$ c0 d# |% \3 O try: a# u' }! X. F) W4 G
{; r8 c2 [# x9 u
//---- Enter your callback code here -----
6 C" U0 }: E! {- L) B
X% e6 N n' G+ w; g8 V$ H0 m
3 J3 G4 y1 k. U `" ~
# k. i, n: p9 A Session *theSession = Session::GetSession();# m4 ~: m8 h9 [% i
Part *workPart(theSession->Parts()->Work());0 z9 K: V" r: M1 {1 R1 R
Part *displayPart(theSession->Parts()->Display());7 B0 Q4 |0 X' ^/ K' g0 U
8 T3 L; `" f7 [9 b# J
) Y0 f0 W) J% _/ }8 L* G& Y, e
Features::Feature *nullFeatures_Feature(NULL);0 m0 V, ^* t# F8 Q# a
Features::EdgeBlendBuilder *edgeBlendBuilder1;* h" U8 ~5 W6 q; k
edgeBlendBuilder1 = workPart->Features()->CreateEdgeBlendBuilder(nullFeatures_Feature);0 C1 x" O* U5 _5 ^% }2 k& M
# W) a* L+ t' b$ W5 f9 g
: |: V& A4 d. e5 L; z5 d5 k
ScCollector *scCollector1;
* N& ]! T) n1 \7 O' z: k: l scCollector1 = workPart->ScCollectors()->CreateCollector();
1 j, `6 P% P- ?: x; _4 N* \0 v. i7 J: v: O, z
4 N K5 F* K4 k
std::vector<Edge *> seedEdges;% C* \. I: r( t, H
; D7 ^% l3 w- J, w; i std::vector<TaggedObject*>selectob = edge_select0->GetSelectedObjects(); //获取选择的对象! r; I% z3 K- V2 Q% I9 S
for (int i=0;i<selectob.size();i++)
4 [" s e9 Z" S, Q6 O _ {
9 V2 H% U" I. Q+ u! {0 V seedEdges.push_back(dynamic_cast<Edge*>(selectob));
) H+ w9 i' G7 _' j& Q/ H( s! f }5 v( L4 K* k1 T! C# D- P
+ r! Y, W& u' b0 H' b6 O double dia = expression0->Value(); //获取表达式的值
4 p' E- I) W% \; ?0 Q stringstream DIA;1 v1 X6 c5 w: f4 `6 y$ s
DIA << dia;% m7 \9 y/ p2 N) L" e2 Y" M
: x) d5 j& ^% [
4 D8 X8 @! T0 e! |0 N& W EdgeMultipleSeedTangentRule *edgeMultipleSeedTangentRule1;
( R6 _ r9 U5 T! U1 z edgeMultipleSeedTangentRule1 = workPart->ScRuleFactory()->CreateRuleEdgeMultipleSeedTangent(seedEdges, 0.05, true);
: j/ _9 Y( u6 l$ B- X( p6 x2 B( d: n3 a
- S7 F- [3 n( O) j8 L2 w, m& w std::vector<SelectionIntentRule *> rules1(1);
3 ?. |( W! n, E rules1[0] = edgeMultipleSeedTangentRule1;7 X) C2 Z, w/ ^! B# H: ]3 \2 h
scCollector1->ReplaceRules(rules1, false);
# T! v+ u5 B0 I V0 R
2 @" l2 {( Z9 N
! _9 L$ q3 j* e9 ^( p! ~& g6 ^ edgeBlendBuilder1->SetTolerance(0.001);8 h6 P9 d5 I3 a5 V# m
: Q: a+ e8 }# Q% } G- p2 F7 v' ]
( d4 n! n: D6 e) R edgeBlendBuilder1->SetAllInstancesOption(false);4 ~$ I- u+ k: H4 `+ X$ K5 u
; u: E. R" g: r. n" V0 |& E1 b c0 q% Q
edgeBlendBuilder1->SetRemoveSelfIntersection(true);
+ O1 N( q$ E4 f- @3 ^8 a! {: U2 B8 }: ~
% K1 t7 J7 o- ?6 M# I edgeBlendBuilder1->SetPatchComplexGeometryAreas(true);
8 }6 \: [2 p: L$ C. A
9 x6 [( g% s& P, j/ R8 E2 \# E4 D2 w
edgeBlendBuilder1->SetLimitFailingAreas(true);( a; c m# }; J+ ?
# ]1 u8 @ O/ N" N* `3 t s3 L9 z c& s2 w0 ~/ O |7 Z
edgeBlendBuilder1->SetConvexConcaveY(false);, }; ^) i7 |) u$ U+ S1 _: B& t
# [( V6 o/ t% M
$ k0 G$ w$ t( H. r3 q: N7 }: C edgeBlendBuilder1->SetRollOverSmoothEdge(true);7 G9 O" x6 L) Q* \3 f; Z
$ b$ y5 e6 \0 L& _
( ]- h' J) Z$ K' ?' q edgeBlendBuilder1->SetRollOntoEdge(true);. v X% |8 w1 h" e# }" q) x% I
! J' U: v$ L; b2 Z, a. E. P2 G
, G6 }' X- c+ f0 Z+ w/ Y edgeBlendBuilder1->SetMoveSharpEdge(true);; G1 }* u( e2 p# B6 r2 c
+ T* Q1 s5 Q/ \4 Z. a$ o3 C" w8 o8 u7 `. ?1 p( z+ M
edgeBlendBuilder1->SetTrimmingOption(false);* n1 m" w2 L5 W. i+ F3 f
- D) W' M; d6 Z6 z- n
3 y8 l" V9 i1 J6 F. U$ W8 J& q
edgeBlendBuilder1->SetOverlapOption(Features::EdgeBlendBuilder::OverlapAnyConvexityRollOver);; L3 G# L$ e- ?; J6 c
U: f7 \: w: g5 K2 [
& T, v) b( _! @9 p% q2 w1 x edgeBlendBuilder1->SetBlendOrder(Features::EdgeBlendBuilder::OrderOfBlendingConvexFirst);; Y6 D9 t! h/ T) p
4 b# G6 s) O" I* ~" Y3 G2 d
: u; F; p1 @0 \; _' s$ j) P edgeBlendBuilder1->SetSetbackOption(Features::EdgeBlendBuilder::SetbackSeparateFromCorner);
- G2 E! ?6 A2 Z0 r, [4 ?
3 C+ [' V) t7 E! A4 H/ Q# g6 k7 o7 U1 V) h
int csIndex1;9 m7 s- d; j i2 {2 Q$ W
csIndex1 = edgeBlendBuilder1->AddChainset(scCollector1, DIA.str());+ d% |4 F: X5 r4 s3 b" X
3 b: g2 F9 |7 Z+ l
2 B5 Q( |! \1 i& V
Features::Feature *feature1;
3 C. U% W2 ?& @0 k! Z feature1 = edgeBlendBuilder1->CommitFeature();
t! O* L% H2 q9 P/ c
5 }' u8 h5 B, r( g9 `' I' [5 h. d$ O% b% x/ B
edgeBlendBuilder1->Destroy();
* K! A6 u( G% t. ?
$ k/ t& v% i0 n+ | }
[2 r+ f6 N4 Y/ h5 ] catch(exception& ex)$ s# y4 A3 C7 N+ t: L7 A; z `$ X( a- r' w
{
9 K& ?- a3 J# i1 q' X) C //---- Enter your exception handling code here -----& ~8 w& h- U3 c7 G( m
errorCode = 1;7 j" G; |, k& d
selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
* \/ |( G" c0 k3 O, U* } }. U( v; e/ D* y2 P
return errorCode;
+ }; ?, o, r1 L5 t9 r}+ O/ N% t0 \; c3 \: N+ @
, R3 {4 |! s, Q* Z& ?% V0 {
说明:因为字数有限制,这里只贴出关键代码。
) M2 C# \( C3 P( T( {! |
9 G- c9 k3 `4 ?6 p. U7 ?% G3 P, R) v ]! `0 W3 P! I) q
' {1 ?7 }- s6 g( Y% \. Y |
-
评分
-
查看全部评分
|