|
|
秋爱
发表于 2015-8-15 09:15:43
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- l/ c) h: N% W4 ^7 ]) zvoid selectedge::initialize_cb()
8 {3 ^) ~$ |* s) U# o% h{
9 U; B( X5 K7 L; J try, U8 X, Q* G: y3 x+ ?
{
0 k& Z# {3 g$ [# R group1 = dynamic_cast<NXOpen::BlockStyler::Group*>(theDialog->TopBlock()->FindBlock("group1"));
0 j* T, B; \( ]: [ n+ x3 y- k4 \ edge_select0 = dynamic_cast<NXOpen::BlockStyler::CurveCollector*>(theDialog->TopBlock()- >FindBlock("edge_select0"));
' T/ w$ x Z) f expression0 = dynamic_cast<NXOpen::BlockStyler::ExpressionBlock*>(theDialog->TopBlock()- >FindBlock("expression0"));}" x1 e5 A4 Z k4 V- G* N
caTCh(exception& ex)5 o4 A, G, `) _6 c
{
8 ~. l$ a/ X# i. q+ A; a //---- Enter your exception handling code here -----
+ _+ k k2 s4 H2 k selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:dialogTypeError, ex.what());
+ A% t/ O5 o; J0 y7 Z/ x' [6 C& O }
) u/ {- J( ~: W: F3 t$ P2 _+ h) x- r}
$ O5 p* L5 Z1 }, Z q+ Y/ M$ J& W$ z$ J6 l' M% t
int selectedge::apply_cb()" ^8 \4 s4 J# z7 a, b
{
) Y+ t% B; V5 H" n0 t int errorCode = 0;! c" C4 w: a+ t- b. t. Y1 @" G
try
* ]. X" w9 Q; P5 y) h" K) O4 T {
+ X# j. }( f o9 ~ //---- Enter your callback code here -----, [0 A6 M! `0 ]1 R( L
/ ~: m' I4 Q" D9 q$ R* a4 C
1 T; J4 l1 H8 j, c- n3 {6 u2 U
Session *theSession = Session::GetSession();# |$ X, h* c; s+ Q0 Q, A0 Z- P
Part *workPart(theSession->Parts()->Work());6 K+ ~1 f# B6 i! K- P
Part *displayPart(theSession->Parts()->Display());+ e! v3 x: j! o9 E
" \4 z! |2 e, ~; o2 w m* S
& s: B- a* i- B& \3 x, W
Features::Feature *nullFeatures_Feature(NULL);0 p& K: L4 Q [- k8 m
Features::EdgeBlendBuilder *edgeBlendBuilder1;, v2 P) {( q4 P
edgeBlendBuilder1 = workPart->Features()->CreateEdgeBlendBuilder(nullFeatures_Feature);
6 [$ H: S. M# v5 e$ ]0 x: @1 k
- W+ s M9 u9 F& n9 a1 |# ~8 V. u$ V4 k
ScCollector *scCollector1;
/ k M4 z' a# ]# _/ [+ q scCollector1 = workPart->ScCollectors()->CreateCollector();# a6 Y# s# d& t# D( l( D
! m9 h9 B+ a3 O" {
( j9 P8 X0 i; r" c8 l+ k std::vector<Edge *> seedEdges;- W9 f: L, B" Z- K4 `4 s7 G9 [
7 a R$ n) D1 T4 ^& [* A, H
std::vector<TaggedObject*>selectob = edge_select0->GetSelectedObjects(); //获取选择的对象' u* @8 |/ H( m- {! w
for (int i=0;i<selectob.size();i++)% O$ h, U! ~5 R/ L& M
{
" u G, ^. I3 `. }- m$ ^ seedEdges.push_back(dynamic_cast<Edge*>(selectob));* g* X# U4 o/ s* y8 U* A9 ]
}4 a P( t, D0 w, B# e
3 m( N' s1 A8 F0 | double dia = expression0->Value(); //获取表达式的值* l6 Z0 |% ~1 T' Z3 G" L# _
stringstream DIA;) H9 A: B) W; \2 r0 C$ }
DIA << dia; [! b M/ W, s3 _: h' p
( e ?' Z5 j2 X, p$ e
7 n9 S% `# h! q EdgeMultipleSeedTangentRule *edgeMultipleSeedTangentRule1;
: B/ Y* a: I9 B* N& @; M0 b( b edgeMultipleSeedTangentRule1 = workPart->ScRuleFactory()->CreateRuleEdgeMultipleSeedTangent(seedEdges, 0.05, true);
: I/ b& Y- Q- v! V9 m6 @3 ?: x
5 b/ Z- J. E6 \& l) H7 L! \8 K1 ~% H
std::vector<SelectionIntentRule *> rules1(1);7 p% O c2 ~) G8 M& _( r; Y
rules1[0] = edgeMultipleSeedTangentRule1;
% A" r+ c9 ~7 x* r7 { scCollector1->ReplaceRules(rules1, false);" b4 P a L, h8 n j* x% K; R8 F
5 R$ K8 }$ ^0 f2 u4 m
( V5 r- J! u! R# Z. Y edgeBlendBuilder1->SetTolerance(0.001);
& e; v2 _* N, }' c6 `7 K) F$ ~
) D3 R) d/ }' \$ e9 I6 V8 r) O5 g4 t$ f* C; ]
edgeBlendBuilder1->SetAllInstancesOption(false);
/ w3 u5 k/ W! C8 t2 F) ]! ?0 S% o: l
0 m) g3 N& a6 B) \; H- ?6 z. a: D2 Y; c* ~
edgeBlendBuilder1->SetRemoveSelfIntersection(true);/ {; }5 k! p; W; c" _/ H$ T
1 s) Y& w) `: P/ b
* I3 ` h$ X7 n+ X( Z0 _6 l! R6 p' ~9 w edgeBlendBuilder1->SetPatchComplexGeometryAreas(true);
" ]$ }, J, L2 J9 i5 {1 {/ |$ [, ^ J3 q! X- e$ O# X
" ?2 B7 m+ T: ], B
edgeBlendBuilder1->SetLimitFailingAreas(true);, ^( A" W" _+ G# g
7 k1 ^3 {0 J9 ]. x& H( P% ^3 G% e! |7 [- o9 M
edgeBlendBuilder1->SetConvexConcaveY(false);, K) T, @" ?3 t7 b
! u( E* x2 q$ P4 K3 X! |
' r4 s0 l- [+ _+ \ edgeBlendBuilder1->SetRollOverSmoothEdge(true);. w9 S3 L# ?2 J( F- F
e, y9 C9 ~% A' l( Y7 L" g' F8 F+ n0 _1 v5 V% l
edgeBlendBuilder1->SetRollOntoEdge(true);
9 \2 Y! Q7 s! F' {3 N" O' r
- L9 {, ^2 G; t* n; e, a/ [8 G/ W7 u& W m: K" W
edgeBlendBuilder1->SetMoveSharpEdge(true);. J( [/ l N+ N5 ]" z/ k
9 p# ?/ H9 c Q# [) l0 I! c3 W6 V( E$ I
edgeBlendBuilder1->SetTrimmingOption(false);! X1 ]$ Q+ ^/ L( d/ {
, a" \# f0 \( {$ h
: t" N0 c; a- F# P( |! p
edgeBlendBuilder1->SetOverlapOption(Features::EdgeBlendBuilder::OverlapAnyConvexityRollOver); Y' ~; O: E) u/ p1 J. G* ?
( {' @1 f$ [/ C% j. R+ y3 T
" G$ }9 W3 _; [% W: A
edgeBlendBuilder1->SetBlendOrder(Features::EdgeBlendBuilder::OrderOfBlendingConvexFirst);. i* V, Y: ]# z- ^
& a3 _' l8 b; }
) B& ]$ i. `8 q9 F( ?$ W edgeBlendBuilder1->SetSetbackOption(Features::EdgeBlendBuilder::SetbackSeparateFromCorner);, L& S f9 m! X/ \' n/ Z% ?
6 R9 U$ I) a8 Z/ v0 M. P' |. C! H7 {* v- Q
int csIndex1;
& |7 s3 ]& S$ ?- S) m' N$ k csIndex1 = edgeBlendBuilder1->AddChainset(scCollector1, DIA.str());
! O0 r4 f8 I3 W" M. {
2 J2 @& ~+ v9 m, j) X* n# b+ r& R6 Q( v3 T* j
Features::Feature *feature1;+ b. {, N+ O( G& v* I* C0 X
feature1 = edgeBlendBuilder1->CommitFeature();2 z7 F F( [* q
{9 ]- k/ ]; A y. X$ u, N3 L) N1 _
& W& u8 H( n9 f0 m edgeBlendBuilder1->Destroy();% [# a% @/ U* t5 P
0 g3 o2 b& |2 E/ i# \( ?' j- j- E
}* ^# |: r0 ^7 w! R9 @4 m6 {
catch(exception& ex)
& R- X+ F" P8 @! U {$ E/ \* M9 \: W
//---- Enter your exception handling code here ------ r8 [* \! N+ o1 F' O4 w
errorCode = 1; Z( o | ~3 R$ u
selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());7 W8 V; i& l# b4 `( w% l
}; K8 I! U8 o b" u1 R. h0 Y
return errorCode;
, r, Q9 s' n3 C- I( Y} u3 D4 N1 `! U: u: h' O: w
2 k9 ~; l5 k6 I, ]+ X7 t说明:因为字数有限制,这里只贴出关键代码。. |( n+ L7 h( _7 n& F2 A% N
/ i" k$ s9 |& \' }8 o* k
' V" U% |% ?2 D \& K$ P
, H$ w+ w- v/ n' x$ `8 Z |
-
评分
-
查看全部评分
|