|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
代码分享下,其实场景是这样的,我们要需要抽取一个边的线条,通过composite curve去处理,但是在非装配下,基本上是通过composite curve进行抽取,在装配下,需要通过 wave link composite curve,两个方法场景不同,这就需要进行分别判断。
- M0 [* H3 }$ G
, K6 w' P0 _! X紧紧判断是不是一个occurence还不够,因为在选择边如果零件是工作部件的话,这种情况wave link是无法使用。
( ]( h4 B' b+ f' N0 ?: R* _. u3 ]
6 n! ?' V* j( e( @8 u if (!selectFaceGroup1.empty()&& !selectFaceGroup2.empty()&& !selecTCurveGroup.empty())
4 `. F/ y+ s: M( F, e {
) B" r7 F1 K6 J+ F // we need add more check for the edge selection- x1 B7 W7 x5 |; a0 R
for (int i = 0; i < selectCurveGroup.size();i++)( g) \* A N* f) L' W
{
9 m) W, V( V, |$ q- o% w8 {, Z3 | //////////////////////////////////////////////////////////////
. ~- ?8 Q7 P. T! C" f5 y Edge * selectEdge = dynamic_cast<Edge*>(selectCurveGroup.at(i));
3 z9 Y; O! r! r. c `, m0 c8 Z if (selectEdge->IsOccurrence() == false) V' l- o3 G9 Y! @9 _0 o
{8 A; F2 Z* D5 a, y
selectedEdges.push_back(selectEdge);9 y$ Z+ B9 P& D9 z) n* Y
}* R! H3 [# G* _) i
else
& \' V. h/ @+ e" e+ V% t/ L {
/ J$ |7 k* q% ` if (selectEdge->Prototype()->OwningPart() == workPart)8 R2 z+ c- e0 R
{
0 o; X4 B# s! c0 C% | selectedEdges.push_back(selectEdge);
+ K" M0 W0 ]& K1 v q }# W+ D- {) n' M9 F! x3 D
else, |3 [+ r9 I* ?! q! h
{ h; e7 j' u' n, P& H/ f1 \+ \8 P
selectedEdgesOcc.push_back(selectEdge);
+ p' a3 }: M- {2 J; I } }* d+ m( p, Q% h, q& N
}
# S5 z, a5 L/ E& r) G }
- B; `% L- O+ ~8 _* b- B
6 d' P# A! Z c; e+ }; s * N4 ?& q" M) c5 ?: ?' T W6 ?+ o% u$ k
//2 get composite curves F" j% n% K% R
if(!selectedEdgesOcc.empty())( {/ x# S: Z1 ]. a6 s
{" r$ R& \- k8 G! R
errorCode =createWaveEdges(selectedEdgesOcc,compositeWaveCurves);
) B+ `6 N- u5 E* `1 S5 b) L if (errorCode || compositeWaveCurves == NULL)7 `# Q. z8 i! a$ b+ V5 }9 g
{3 V1 ^6 [* `+ q% ~# l# Z" X- e [
CheckDTS::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeWarning,"Create Wave Composite Curves failed!");* N. z, ?3 Y% J8 X3 y
return 1;+ V0 q: H L3 `* `
}+ j# x5 \. u& W+ Y* j
vector<NXObject *> allCurves = compositeWaveCurves->GetEntities();
8 X! Q# F' v, z
* i n5 Z1 S5 \- _ for (int i = 0; i < allCurves.size();i++)
( K. D$ |1 R5 z1 k. v3 ^ {
; w5 `* h/ o& K# t t3 D9 _+ E' [ sectionCurves.push_back(dynamic_cast<TaggedObject*>(allCurves.at(i)));# S3 l( i! H/ d* t- a4 w2 U
}7 Q; p' o. i; s1 ]
}
( q, x+ @; Y% L0 M- U+ M! { if (!selectedEdges.empty())# _" |$ b7 @' m$ w& b9 R: _+ X3 o
{& k/ A* K8 s+ f2 \# M" P; Z
errorCode =createCurvesFromEdges(selectedEdges,compositeCurves);
, d2 i, K0 W" ]! N5 @& f4 K+ W* @ if (errorCode || compositeCurves == NULL)) w# v$ i) q" o) Q; A
{
% S) e2 o/ x1 R3 _9 R+ S9 Z5 r CheckDTS::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeWarning,"Create Composite Curves failed!");
6 l/ e, b; h4 w# I$ G" |- G. t return 1;
* S& u2 [( n( q8 X }! e; K: C6 V) E5 a
vector<NXObject *> allCurves = compositeCurves->GetEntities();
7 p- F8 \' E: U/ _& O for (int i = 0; i < allCurves.size();i++)1 ]' y4 l3 Q" `
{2 d2 Q) h- E3 K+ z" m [
sectionCurves.push_back(dynamic_cast<TaggedObject*>(allCurves.at(i)));5 q, ~$ O: a0 |: C
} 9 ]8 \6 U l) G2 y& I; H
}
( D1 Z* {. T4 N: H5 N! [" W- k5 c5 d, M- Q5 k7 p* Q# d
|
|