|
|
秋爱
发表于 2015-8-15 09:15:43
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
& J# _; F4 l1 P1 m) D) Xvoid selectedge::initialize_cb()( N: F' P" A2 E2 Y
{
. s; R' Q% j9 P* I3 W% B9 N' y try- ^# i: v Q( F' P' n& P* K/ q7 f
{
" ~7 A: I4 L1 v3 U group1 = dynamic_cast<NXOpen::BlockStyler::Group*>(theDialog->TopBlock()->FindBlock("group1"));" C. |5 Y2 I; S! n. S3 _2 A
edge_select0 = dynamic_cast<NXOpen::BlockStyler::CurveCollector*>(theDialog->TopBlock()- >FindBlock("edge_select0"));1 Y, o, d, j# U; O, i
expression0 = dynamic_cast<NXOpen::BlockStyler::ExpressionBlock*>(theDialog->TopBlock()- >FindBlock("expression0"));}
% Q( E E% x# M: [( } caTCh(exception& ex)1 ]. p- J4 \9 B% X7 f" C3 d
{
. j6 O$ C" P( r) C; p7 ^ //---- Enter your exception handling code here -----4 j& \% l4 e( j
selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:dialogTypeError, ex.what());
( w4 e; K9 Q% S0 D" X% R- R }
% p1 p' a% |4 W8 t0 f}
1 z" X- J+ T5 t! C7 J/ G: y: C
: p' S% s+ I2 i# j% H- }int selectedge::apply_cb()% j0 F# S4 Q. m' m$ F* R
{" {, w- i2 z* \$ n& M+ |
int errorCode = 0;
; u w4 f& T; K3 ` try
! o* ], C" Y+ w( L* }; ]- H5 ~ {
2 j% V& u2 k7 ^$ t/ Y" p //---- Enter your callback code here -----
/ o- T* t$ e# F. b) r* [7 Q( A5 y/ g/ |; M0 R
2 {6 z& K2 j4 q- H3 m; `0 ?6 j: h$ X) U% u0 E0 {* o( g- @
Session *theSession = Session::GetSession();/ h: Z+ U; ~$ R
Part *workPart(theSession->Parts()->Work());
4 Y: ?! w: ]1 A Part *displayPart(theSession->Parts()->Display());+ k# f- o7 ]' _
2 H. W! u% Z' G( R5 C
4 Z ~0 A0 `4 V3 A9 D* X! ~) D
Features::Feature *nullFeatures_Feature(NULL);, a0 A/ v" C: x7 M
Features::EdgeBlendBuilder *edgeBlendBuilder1;1 L- ?: a9 h8 G6 o. h/ \5 m8 h
edgeBlendBuilder1 = workPart->Features()->CreateEdgeBlendBuilder(nullFeatures_Feature);
/ j# s4 e4 V$ q9 E/ {1 {
4 y9 m" m1 ^0 _" a3 _5 o# {, o) ^1 {! D5 A7 T# X
ScCollector *scCollector1;
( V& p/ k! ^: w6 V scCollector1 = workPart->ScCollectors()->CreateCollector();
; f' y3 B1 g$ B! u8 M
" i4 @) A+ K7 @+ y: S# e3 \( Z) n t) [( v' S, |3 q
std::vector<Edge *> seedEdges;8 _& M9 g/ R* b; \
0 X8 q( j" k) P& p6 O& d: |0 I4 n& U std::vector<TaggedObject*>selectob = edge_select0->GetSelectedObjects(); //获取选择的对象9 D$ ^3 r1 V( ]1 H
for (int i=0;i<selectob.size();i++)
+ K3 @# t( j9 ~- V0 W" f {3 e3 S2 J s* E: n( Z" A2 n. c) H& q: S
seedEdges.push_back(dynamic_cast<Edge*>(selectob));
8 o0 m2 K" a" u6 K }
$ u% I4 G9 ]( L2 ?( c1 q
+ p- h! X! P( B, A- |' z2 W) y9 K double dia = expression0->Value(); //获取表达式的值5 y% ?$ ^/ J3 W
stringstream DIA;0 k) j! g$ f8 @' r0 Q
DIA << dia;
2 t% T, g" c3 n5 g. L5 H4 [" h2 q$ m
. G2 c2 R9 `3 M) L
EdgeMultipleSeedTangentRule *edgeMultipleSeedTangentRule1;
. W5 k5 n9 A6 M edgeMultipleSeedTangentRule1 = workPart->ScRuleFactory()->CreateRuleEdgeMultipleSeedTangent(seedEdges, 0.05, true);
: G+ N5 ^* |) `* n# s
( M/ o9 i7 v1 F
+ z9 S. L1 e. Q- q8 d std::vector<SelectionIntentRule *> rules1(1);
2 p3 Y% _' _1 t! I8 b( o rules1[0] = edgeMultipleSeedTangentRule1;4 M* a3 W3 O7 F1 S; T$ J! g9 F
scCollector1->ReplaceRules(rules1, false);* j6 N+ H ^: B. q G1 B$ k; q A3 D
+ @0 n$ U4 Y7 `; W9 Y0 {& f8 p2 f) o# n9 Q* l0 i+ b) E6 r7 k1 A3 a% D
edgeBlendBuilder1->SetTolerance(0.001);+ `0 h' e$ I. M4 E3 g4 n/ v
! R! k. Z% s2 K- d$ ~. h5 @2 w
+ i1 ~- q' D, }# Q) U) ]& v$ G3 Z edgeBlendBuilder1->SetAllInstancesOption(false);
0 r7 G- p( S, O' f0 x/ m2 _5 R" W3 s6 M- |$ A5 r: Q
1 d8 ^/ U$ C* z: a
edgeBlendBuilder1->SetRemoveSelfIntersection(true);
3 N' h& D9 Y! L' w3 w. [/ q; j( o4 N- S/ C& |% X
% A0 b# |1 O4 w1 j3 c% a
edgeBlendBuilder1->SetPatchComplexGeometryAreas(true);5 X) C6 X! n) j h* i( @+ a
* o" [- }* E! ?7 D6 T5 ]
) `" }/ M8 Y8 a( S) Z( K edgeBlendBuilder1->SetLimitFailingAreas(true);3 ^0 n. E! C6 P5 ^6 |- Q
" F: @, C2 K) m3 Y7 ~- }8 U p
" e' ~- t/ r# v( U2 [) D! E edgeBlendBuilder1->SetConvexConcaveY(false);
1 ~; y S M3 X
* J8 _; n% C7 g" _$ [& }# X: u; x$ q; s2 K! y. C) l
edgeBlendBuilder1->SetRollOverSmoothEdge(true);( @( c/ y3 B, R6 q; `: l
$ R5 `8 ]; D2 H# N- {# L$ r
' @( B2 E. W3 r7 k edgeBlendBuilder1->SetRollOntoEdge(true);
5 t5 g% h) ?2 B; U: A
# h3 G7 Z5 }+ ]# O/ C
; E5 o# C. W T edgeBlendBuilder1->SetMoveSharpEdge(true);* H2 p! a* s2 @ f( p* A7 I
# O* x* l, p3 y
' f. c/ ^- V" D edgeBlendBuilder1->SetTrimmingOption(false);4 [( g" o9 w: H$ E2 ]7 r, I/ _
" P# z7 l& L7 h; h/ A6 n; d1 M# z* _2 }* W; l/ R
edgeBlendBuilder1->SetOverlapOption(Features::EdgeBlendBuilder::OverlapAnyConvexityRollOver);
4 f6 K0 I# y+ E1 d4 H# _3 ]
6 \6 h% M4 ?* q/ ]( ], V# z, h2 Z o
edgeBlendBuilder1->SetBlendOrder(Features::EdgeBlendBuilder::OrderOfBlendingConvexFirst);
" n8 m8 Y4 p: o# A+ e% {) n9 y7 H' n" }& d4 I" V: I
! ]( H& p0 B5 a, ~4 ?4 ~2 v
edgeBlendBuilder1->SetSetbackOption(Features::EdgeBlendBuilder::SetbackSeparateFromCorner);
+ n/ W: p/ d" J% }# S1 s
, @5 i5 v2 q8 Q% j: U% v" J1 l2 C) u2 T! y. G$ W# s
int csIndex1;; s0 e8 [4 x" \/ k9 E6 n+ [# |
csIndex1 = edgeBlendBuilder1->AddChainset(scCollector1, DIA.str());
3 A$ s/ e. s! ]- n
, ^7 e( \0 b" M/ K
, t2 F, z8 V% s2 i8 F4 }4 X Features::Feature *feature1;
# j: V* M$ s R# w) f% M; ]! ~' M feature1 = edgeBlendBuilder1->CommitFeature();
; f8 z" Y O" e2 l( f \& X7 N- K' M
4 Z# b/ _# W' `. i
edgeBlendBuilder1->Destroy();$ @# x+ b8 H% Z/ j$ [% ]6 X
1 z/ \# e# f% R8 k
}$ Y/ `: ?+ G+ g% Q' c' W/ j
catch(exception& ex): V% L; w6 h; ?+ i) J1 L
{
/ s# A6 f7 E2 [+ c: | //---- Enter your exception handling code here -----" Q$ C1 J4 [, I# F
errorCode = 1;
' h2 d' m1 K. T4 T5 n l7 f selectedge::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
4 F/ @! O, Q- {2 g }8 d5 g# X" W" O) O2 r
return errorCode;
* l D/ ^1 h0 O0 s* k) H}0 F, ~1 S) {4 V
- X) P# L! H8 ~3 [% y说明:因为字数有限制,这里只贴出关键代码。
H/ M4 w! [) Q* u, A; b3 B1 d+ `7 n0 N& b
9 W2 f. a9 N, }! W, Q4 c; W: J% j( _3 `4 ]
|
-
评分
-
查看全部评分
|