|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
! B& d; J8 r- y2 u. t* Fvoid selectedge::initialize_cb()
. |) d6 j t" R{
, ~/ m( `% D4 U) ^1 J; {. c try. Y+ H; v4 `# D
{
, r4 D) a/ u1 `4 k, m& y, D group1 = dynamic_cast<NXOpen::BlockStyler::Group*>(theDialog->TopBlock()->FindBlock("group1"));
/ E8 {& z( p8 w" C& i. g edge_select0 = dynamic_cast<NXOpen::BlockStyler::CurveCollector*>(theDialog->TopBlock()- >FindBlock("edge_select0"));# v Q" N. D+ F2 c& x2 G
expression0 = dynamic_cast<NXOpen::BlockStyler::ExpressionBlock*>(theDialog->TopBlock()- >FindBlock("expression0"));}7 L* R1 i1 o8 |+ w- m
caTCh(exception& ex)" U' c- e, P" t0 i: y' d& ^% o
{# b5 G n) X# `. |, k4 a
//---- Enter your exception handling code here -----
2 ^" t+ n# g$ Y; j0 W! U { selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:dialogTypeError, ex.what());( ]' t, y+ _6 ?( l
}
2 o% O( z! @; h) ~5 B' y2 n0 m}5 a" D# R+ S! }" f
" v/ s" ]: B. w$ Qint selectedge::apply_cb()1 P% `- g( a6 N
{
: y! _: Z1 w4 o5 y8 ~3 d% C% K6 ]" y int errorCode = 0;
6 m Q) A l1 j% L$ L7 F try
' D4 t5 u) b% y; T1 l {0 L- _8 i, D- w8 B5 l- [
//---- Enter your callback code here -----! H0 x* v& X7 _& y& g" z
! Z8 T/ q* ~7 K4 J o3 A5 g& I! }1 ?2 j1 v4 }$ V
! h0 b2 T9 H/ w3 F& `3 k3 x Session *theSession = Session::GetSession();
2 ]/ ] y; Q) u- @# a7 X Part *workPart(theSession->Parts()->Work());
1 G: Y3 L" ?, Z4 E" `( A- `% ? Part *displayPart(theSession->Parts()->Display());
0 u, g! m0 g h% ^0 V( n# }' e
0 B: Q! W& {- e% H) @
Features::Feature *nullFeatures_Feature(NULL);$ P' h9 }' \$ A0 ~$ Y
Features::EdgeBlendBuilder *edgeBlendBuilder1;
% Q" k% x4 m& K5 M0 @( C: i edgeBlendBuilder1 = workPart->Features()->CreateEdgeBlendBuilder(nullFeatures_Feature);
2 D+ D7 M% U$ B! o% z2 o! I
- i( q" ?* @; D& v, j
: ?$ r1 v) s; a4 H ScCollector *scCollector1;
3 G' t( [" }6 C- k" D0 `6 p+ j scCollector1 = workPart->ScCollectors()->CreateCollector();0 u: L4 h! Z3 t+ C' @2 f* q1 b
' a! e! M+ Q0 k* _* Z
( V( }% W; R/ _2 x3 |" v
std::vector<Edge *> seedEdges;; a2 V% ~2 k0 L. Q* ^6 ]+ W/ f6 @
4 ^& ?! F5 b9 S' J, B* L+ ~ Q- ~* d std::vector<TaggedObject*>selectob = edge_select0->GetSelectedObjects(); //获取选择的对象! _, S5 T H% p: k4 ^; I3 S1 A; ?
for (int i=0;i<selectob.size();i++)" C$ E V6 X+ \' z6 w- `
{
( f# N8 P8 p+ b5 B' c" b2 O$ U2 `( L seedEdges.push_back(dynamic_cast<Edge*>(selectob));
1 o& b( L: s3 X2 J }
2 J: T9 @" s2 y
) @, w$ M' B+ C2 B double dia = expression0->Value(); //获取表达式的值
B0 G1 {, Z3 B% O9 p0 S, u stringstream DIA;
6 z7 h4 F4 ?5 s6 j DIA << dia;
. D# w4 |1 w4 C( w( ~) y* m: U m6 y) R: I
P- G& A* [* S EdgeMultipleSeedTangentRule *edgeMultipleSeedTangentRule1;
0 l; x/ L; K& @2 H8 d edgeMultipleSeedTangentRule1 = workPart->ScRuleFactory()->CreateRuleEdgeMultipleSeedTangent(seedEdges, 0.05, true);
- g2 ~, \( G' J$ {+ |5 F& L E2 N
# ^9 \3 o; J) n
( M5 F" B! f: y. `" I/ O5 I std::vector<SelectionIntentRule *> rules1(1);- B s |8 @ f2 K _! D, Z
rules1[0] = edgeMultipleSeedTangentRule1;; N7 c+ u( F3 S9 O* T& ~- r. Z! F
scCollector1->ReplaceRules(rules1, false); g# k7 F& I( f o9 d% k
/ H, {' S3 Y3 } f r( m
7 u/ ~: i& B' ] edgeBlendBuilder1->SetTolerance(0.001);
8 } N- e! H0 Y
' H3 e$ W, R/ Z; Y+ r
+ T0 x8 B1 q# X edgeBlendBuilder1->SetAllInstancesOption(false);3 g# T! x) y y5 c" }: Z% e
D5 U* s6 e: P' t% o0 y ~, h
* v2 V1 P5 z r5 Q1 f2 S H edgeBlendBuilder1->SetRemoveSelfIntersection(true);
, w e; B( c3 ^0 l* i/ E3 p) V7 j6 I S9 c( E ]- b2 n* I
* d; f9 `1 R) ]# t0 N# V edgeBlendBuilder1->SetPatchComplexGeometryAreas(true);
2 m0 u6 s# F3 P6 y1 `5 A8 M' F5 o7 ]7 A& t" t. V6 i' N$ Z
; O7 d" I8 w1 o x! A: \2 H3 D' A edgeBlendBuilder1->SetLimitFailingAreas(true);
4 j- z; h7 @8 ^. B$ S) W7 U
9 d* O# x. | {( W( G: E. K4 m. _, d r% N1 F7 X- S2 T. G
edgeBlendBuilder1->SetConvexConcaveY(false);3 g; _8 X5 h6 k$ y. |
$ x3 o9 @5 m' m& T5 b
5 q2 L* }7 @5 q7 M2 x3 X, g edgeBlendBuilder1->SetRollOverSmoothEdge(true);4 s; N6 D* w: b8 e: M- }
4 t% M, l3 o) u5 p& U" I! o, Y; t% ~3 y6 ]& V$ ]& a4 j8 v/ g
edgeBlendBuilder1->SetRollOntoEdge(true);
8 w9 u- I' e, @2 ?5 g& B* e+ w4 ]
. J, T" S9 u6 |$ l
3 k" ^- N7 P1 \" b edgeBlendBuilder1->SetMoveSharpEdge(true);
$ X3 i8 x8 i# [
, }- N. _5 {3 |# p: ?' x$ I8 C; a/ h2 x0 c) Q
edgeBlendBuilder1->SetTrimmingOption(false);
, ]( w# l' _* r M- A; {4 ^
/ p- P" }, g' o) `6 E8 c$ `; A1 d: I3 y% M
edgeBlendBuilder1->SetOverlapOption(Features::EdgeBlendBuilder::OverlapAnyConvexityRollOver);
3 g1 j0 O; H+ n1 y- L F& y( e: m- q. n, t* b9 o/ x1 [
, X& @" J+ G( l edgeBlendBuilder1->SetBlendOrder(Features::EdgeBlendBuilder::OrderOfBlendingConvexFirst);+ H' Z F" _: A4 _+ ^( m
$ ]5 o$ @1 k+ M
, ]1 Z0 j6 r) X" h edgeBlendBuilder1->SetSetbackOption(Features::EdgeBlendBuilder::SetbackSeparateFromCorner);* x7 @/ w- {; s
: U8 T' \$ q2 B4 c$ n4 _
; b: j+ p ?+ z int csIndex1;
0 E) e. `% m$ h! W csIndex1 = edgeBlendBuilder1->AddChainset(scCollector1, DIA.str());
( E1 n/ C: Q* Y$ R s! T$ b0 F% `- ~) C- _. X2 g" U
- ]) [! l5 g' S c+ |. W Features::Feature *feature1;0 E$ y' c. i% ?7 L
feature1 = edgeBlendBuilder1->CommitFeature();
- N. s8 G9 Z6 W7 x* ^- n6 ~' ?" ~; G& j0 o8 J9 b6 i; D
& P3 K% Z3 Q) h
edgeBlendBuilder1->Destroy();) W k: L1 k8 o& V8 T, i K
3 Y+ f/ e) p9 K
}4 H; _3 w9 S$ ^0 x9 X
catch(exception& ex)
9 [# L/ g" S- B8 x! _; h& R {
$ X: C* J$ Q, O) X( L //---- Enter your exception handling code here -----$ |9 y' i3 l9 {) s- y
errorCode = 1;
1 z _& h& Y# T7 }% R$ w selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
' x& k: n% h' ]( Y3 P/ O0 a* |( J }
n" B* [0 x4 m3 { return errorCode;
* [0 C6 M* Y! b5 {}
& A, F9 m; ~) p3 W4 A% C7 M* Y6 p
说明:因为字数有限制,这里只贴出关键代码。% X0 M. M# s; a2 a& m
$ [+ n2 N/ J( j
& f) T" {3 K# X0 r) s7 t
2 B8 X1 r: P M
|
-
评分
-
查看全部评分
|