|
|
秋爱
发表于 2015-8-15 09:15:43
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
( k4 C3 v) m5 k5 k5 @+ |
void selectedge::initialize_cb()
$ J7 _2 H9 p; s+ I. g+ e1 t{
9 O7 q7 G! K- h try$ ~& b% P; \* U9 G
{, T7 ~0 O, z% p" E% a* M4 Y3 R8 I
group1 = dynamic_cast<NXOpen::BlockStyler::Group*>(theDialog->TopBlock()->FindBlock("group1"));
& V+ M/ J2 l6 E' `1 R3 n edge_select0 = dynamic_cast<NXOpen::BlockStyler::CurveCollector*>(theDialog->TopBlock()- >FindBlock("edge_select0"));
, X4 T' g0 P. v2 c B expression0 = dynamic_cast<NXOpen::BlockStyler::ExpressionBlock*>(theDialog->TopBlock()- >FindBlock("expression0"));}
6 p) X3 g" k8 _ caTCh(exception& ex)4 T1 _8 H) N2 X' G5 F* {' R
{
% o" Z; s* v& M //---- Enter your exception handling code here -----" U, P; n8 ?/ L, f4 J# _9 f
selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:dialogTypeError, ex.what());
4 j0 W6 H* u+ M0 S5 _ }
0 o& N) x/ P2 r. _. P/ ?4 V}
/ E2 Y- D$ K' n7 l2 f. w
# k! a) |# n- [6 A! lint selectedge::apply_cb()
/ A- f7 \" L- Z7 [; G{0 O( y. b: R4 ^2 U3 @& `( h( s' A
int errorCode = 0;
5 C7 b% L# w7 O0 U; Q9 W M try* {6 Q- C+ v$ K2 I i% H
{
: \" @: z& g/ Z) R! X B //---- Enter your callback code here -----
' e0 c! v4 v/ k8 M: V6 F. V% B) s
5 C8 K4 h- }/ {$ `+ t8 `) }! Q3 b: _- i1 K! Y& g6 Q( g, z
7 e- H" t2 A- P Z) \% ] Session *theSession = Session::GetSession();
; Y& W; v/ ~8 s. D; _9 H8 p" }# E Part *workPart(theSession->Parts()->Work());& ^1 K0 ]# L, L& |/ W6 _
Part *displayPart(theSession->Parts()->Display());
8 I+ A% Y0 L2 `
' I5 F' J* S$ X0 h8 P( Q2 U; t: }0 t4 j% _3 r( r
Features::Feature *nullFeatures_Feature(NULL);
) T" c: o C5 j7 f5 c% a! ^( c8 M Features::EdgeBlendBuilder *edgeBlendBuilder1;
/ g! v& G- m; ? edgeBlendBuilder1 = workPart->Features()->CreateEdgeBlendBuilder(nullFeatures_Feature);
; ^ _# ^# U% M% u0 W5 z H9 h. V1 |: x3 J p/ d. Q3 G' w
- S+ M: M# [; |' c, a
ScCollector *scCollector1;9 t' ~; z/ F" Y
scCollector1 = workPart->ScCollectors()->CreateCollector();
; J% {) j5 k# k+ F/ l6 b
" j5 R( O9 p* n' [1 n/ k% f; k9 a+ `! a! l
std::vector<Edge *> seedEdges;. V% y) a. k2 `- V% q( Z
; J& d) ]4 p4 @ C+ p5 ]5 H std::vector<TaggedObject*>selectob = edge_select0->GetSelectedObjects(); //获取选择的对象
/ }; B" c; t4 k, s U K for (int i=0;i<selectob.size();i++)
! @$ p3 h) o2 x2 u/ _" } {
_7 @, u A. k2 R$ p% n seedEdges.push_back(dynamic_cast<Edge*>(selectob));
8 t4 a- ~9 x2 i! z. X. f }
) x+ \- h# q7 v+ f9 f) \' ]: y$ f+ I/ A1 G% p: Z
double dia = expression0->Value(); //获取表达式的值) O( N2 P; }1 c, ]& V
stringstream DIA;3 V0 }/ c+ R f! Q) K0 \9 W: z4 A
DIA << dia;% v7 u7 f) H- x
/ o% f& E, u! J: {- A- o4 X; `& X, ~ r% s4 ^3 ]
EdgeMultipleSeedTangentRule *edgeMultipleSeedTangentRule1;4 g8 ]/ i; m; C. U5 c7 M
edgeMultipleSeedTangentRule1 = workPart->ScRuleFactory()->CreateRuleEdgeMultipleSeedTangent(seedEdges, 0.05, true);3 M6 i$ G! F# a$ p/ d
4 W! J1 W. c9 P8 f3 J( B
; \( V$ O; q; b/ K std::vector<SelectionIntentRule *> rules1(1);
8 |. T0 a4 E5 U1 R rules1[0] = edgeMultipleSeedTangentRule1;5 p( u4 [# L/ E9 C2 e" F6 P
scCollector1->ReplaceRules(rules1, false);
; Q# w, x2 U6 @- o+ Z) v E. P$ @: _
( z+ a/ _$ K- [! h; ~' f A- D! u2 |1 ~% G- Y! b+ f( D
edgeBlendBuilder1->SetTolerance(0.001);
! x Y0 I' s/ r- z/ n) I) n$ X% C( B9 g6 j2 e# y! Y
. w6 O/ v3 n& I. t4 R
edgeBlendBuilder1->SetAllInstancesOption(false);9 I1 h" j1 S6 A$ a* b3 M U$ H
, ^9 X" X5 V9 l9 h: B4 W6 U8 k, S1 R) v8 `0 }
edgeBlendBuilder1->SetRemoveSelfIntersection(true);! n8 p# [2 ]* J' R( |
7 D ] v6 a; }- n1 W3 {
' a; Q' }' J* |
edgeBlendBuilder1->SetPatchComplexGeometryAreas(true);
5 m) x. D' h( c" l9 @- ~ I
0 v$ V5 K* D* m6 \6 F2 V5 Q; d3 G
3 B) s/ m7 L9 U, U, z6 V edgeBlendBuilder1->SetLimitFailingAreas(true);, u- T5 q3 @' P/ [' k
5 i$ c s* }8 t: G% j& |/ w& W% I) o# T7 ]" Z [
edgeBlendBuilder1->SetConvexConcaveY(false);
, w8 c) m: y4 ?
f+ F6 J; S! l, v& ^+ V, _! v1 F0 o- V6 L
edgeBlendBuilder1->SetRollOverSmoothEdge(true);( k8 h) g, E2 S* \2 F( d0 D9 l0 q* P
0 g/ V! }' k. X
& C9 x- e! A/ E, h
edgeBlendBuilder1->SetRollOntoEdge(true);# |- ^( y/ o I, |* q$ G0 n
) {' a$ O& k6 L: p3 V5 D
- O6 x* `. m7 n9 X/ c- e
edgeBlendBuilder1->SetMoveSharpEdge(true);! D" I* ^# W& M9 _' J& ~6 ^( j
- R4 x P! c6 J3 P( j: Y, [
1 F% _+ Y3 x* v2 k8 Z
edgeBlendBuilder1->SetTrimmingOption(false);
; Z! T5 X! [( u; v9 }$ W4 }* z+ O( K: y2 }( z9 m7 O
9 \( C0 C. _; ]8 B0 B
edgeBlendBuilder1->SetOverlapOption(Features::EdgeBlendBuilder::OverlapAnyConvexityRollOver);
# z# m5 v# |/ Y" ]7 U4 @6 C
' _) C: J$ [# z4 D) k& G3 [2 G/ P/ `5 d8 }
edgeBlendBuilder1->SetBlendOrder(Features::EdgeBlendBuilder::OrderOfBlendingConvexFirst);
1 D. J. b `9 ]! J1 P+ S$ a; d; O
- i, S/ E1 Q9 Q: C0 Z8 w( \! [ edgeBlendBuilder1->SetSetbackOption(Features::EdgeBlendBuilder::SetbackSeparateFromCorner);
/ m( b1 {) D) | L
7 W2 d7 L6 S' s- t8 t
$ r7 m q7 K4 E1 q; p; a int csIndex1;# w; r- R1 Q6 t$ ]! r3 `: n) s& h
csIndex1 = edgeBlendBuilder1->AddChainset(scCollector1, DIA.str());- ]3 h) `$ _. D: c7 P; E
5 S; d0 E+ t: l, G0 i
) p }/ E# c& a0 Y; A( N* N) H5 A Features::Feature *feature1;
' b+ g8 o( b$ j7 ? feature1 = edgeBlendBuilder1->CommitFeature();( w, ~- P4 j. v6 S0 r) A
2 Y+ `# q1 |& w- H& ]4 w9 R8 t
) D) M" w2 Q6 P2 o9 s5 E& j& c1 J) ] edgeBlendBuilder1->Destroy();
! `$ Q, C! r3 V# V6 K2 p+ E/ U* w. x6 r; a4 L
}1 ]8 l4 k& r% Q, Q: i! A j: O
catch(exception& ex)
/ A& E' W# \. u( X8 L, [ {4 Z* U" @& ` a4 t# e
//---- Enter your exception handling code here -----# q2 f1 H. f) x @& m
errorCode = 1;8 m2 j: M6 t8 L, ]2 o( e! y
selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());( v) l( v* f( [ j
}$ W2 ^. t& ~. H- a! H
return errorCode;' V2 i3 ]" Y% d5 S) L. @" {
}
$ @6 I8 ^ Y+ l* A [
9 v. E; z: b1 l0 ^$ J) ]! a% z说明:因为字数有限制,这里只贴出关键代码。: l; ~0 t7 G& c, b& L7 V6 x* U
& q6 b- e& `8 F( A: m9 f3 w& c
\/ `' f& I s+ F
* M+ u) E) m% H5 E |
-
评分
-
查看全部评分
|