|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
代码分享下,其实场景是这样的,我们要需要抽取一个边的线条,通过composite curve去处理,但是在非装配下,基本上是通过composite curve进行抽取,在装配下,需要通过 wave link composite curve,两个方法场景不同,这就需要进行分别判断。8 j: F R, Y: w$ L1 N
0 H1 e* T3 w+ _* s紧紧判断是不是一个occurence还不够,因为在选择边如果零件是工作部件的话,这种情况wave link是无法使用。
7 p3 x, a# C. R$ r0 C/ Y# f4 b" b) C6 U1 }! @: O
if (!selectFaceGroup1.empty()&& !selectFaceGroup2.empty()&& !selecTCurveGroup.empty())
9 A$ b) S( W7 p' J' S1 p8 X {
1 `7 j% m p& f5 z // we need add more check for the edge selection
5 H T1 q' o* ?" d for (int i = 0; i < selectCurveGroup.size();i++)8 R0 O3 a: s% |0 R* B1 _% L
{
4 h. l3 X% n3 d8 `* }: m5 H //////////////////////////////////////////////////////////////
! e6 `. Q6 z+ V/ y( T9 N9 G: Z Edge * selectEdge = dynamic_cast<Edge*>(selectCurveGroup.at(i));/ \0 q1 O; p8 M" T" K" h
if (selectEdge->IsOccurrence() == false)& l1 t/ R. j J2 y+ M0 S8 s
{
. n; `8 s2 l6 B2 a9 t selectedEdges.push_back(selectEdge);) z: n% {! p. X; T- r+ H& ]& O
}$ H5 T% j& L i. P* W" A
else
& M5 K+ f# G8 V1 _8 x; M {
* v" S. Q0 h8 L/ w1 W4 _+ F- H1 q% g if (selectEdge->Prototype()->OwningPart() == workPart)( K/ D! k t7 @- A# N8 Z7 _9 j4 `
{
# k) R) R6 }9 L1 u1 i selectedEdges.push_back(selectEdge);
$ v2 x1 r* C' @& I }4 Y! e* h/ b, {. {3 I
else
$ c( z3 K. s* \! S! [ {" E! t, \# r) f3 }. Y- {) R Z
selectedEdgesOcc.push_back(selectEdge);
# U8 J# K F$ @8 \- M }% [9 H1 F9 ^) l0 B9 K! m
}. ?% n& B. `: V6 }( E
}
) b/ `" h5 _! v/ E; [; F' \9 o" h! \( g. c, q
6 N$ B7 ?3 W( ~9 D; e8 C
//2 get composite curves
+ f5 `8 ~$ w5 e. l2 f. j8 h if(!selectedEdgesOcc.empty())
$ W5 k- \$ p2 K, k1 m9 ~0 m {
/ ~1 R% \: Z* W6 t errorCode =createWaveEdges(selectedEdgesOcc,compositeWaveCurves);
8 r+ x2 {% _6 j if (errorCode || compositeWaveCurves == NULL)' x4 F; S! [ F& `7 w0 L
{+ V, j2 H4 T$ v! ~9 a. Q- \; \; ]
CheckDTS::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeWarning,"Create Wave Composite Curves failed!");# g& k* h# [0 w4 |# U3 Y2 N
return 1;
: E8 V) p1 o+ R7 A0 J+ m0 | }$ R7 H3 m t2 H3 [4 l, M4 t
vector<NXObject *> allCurves = compositeWaveCurves->GetEntities();
1 c: P: R& K) K* a. D/ W1 d# x7 T& g: A& J6 E& Z
for (int i = 0; i < allCurves.size();i++)
1 F2 s* Y8 X5 T! G {
`3 M2 O3 M0 `/ @4 Q; e0 y sectionCurves.push_back(dynamic_cast<TaggedObject*>(allCurves.at(i)));1 l, J* C5 u& k+ c
}
! u, G6 S/ |# i, ~1 Y' ? }
% ]$ `' X& G$ X+ j if (!selectedEdges.empty())
( e+ n; C1 Y5 }+ [' B {
2 g( P$ K+ G' j- ] errorCode =createCurvesFromEdges(selectedEdges,compositeCurves);
6 t& M# l1 @ m! r9 Q" h' ~ if (errorCode || compositeCurves == NULL)% U+ f1 }9 A% [! O, @, |
{
4 a8 v1 Q; t& K$ O7 L- C CheckDTS::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeWarning,"Create Composite Curves failed!");: D& s9 m3 L4 g) s4 B# Z$ w6 E
return 1;: ^' @. y, T h& Z% r
}" F) g: {. p% a
vector<NXObject *> allCurves = compositeCurves->GetEntities();3 I+ ^/ I( ?/ j3 _
for (int i = 0; i < allCurves.size();i++)3 ^: Y9 k6 L* A( ?0 G
{( Y; h" e5 x. M; _1 ]* V4 Q
sectionCurves.push_back(dynamic_cast<TaggedObject*>(allCurves.at(i)));
+ u+ b4 `9 l: G# K" [* e5 x' @ } ( r9 ^; o" M8 v/ L: q8 h# i9 Q
}# |6 J, t; U( E5 K# g4 p
9 ?2 S/ v% M" ^/ q) d
|
|