|
Each part may contain any number of solid bodies. Each solid body is defined by a set of faces and edges. Each face contains a reference to the body it belongs to and a list of edges that define the face. Each edge will also contain a reference to the owning body and a list of faces that are defined by the edge. NX Open makes it very easy to find the bodies in a part and then to find the relationships between the faces and edges that are used to define the solid body. This section shows examples of how the methods and properties of the body, face and edge objects are used to access the related objects.
1 D' u: C; z* NTypically a body will have multiple faces and an edge will be used by two faces. However, there are exceptions. For instance, a sphere will only have a single face and no edges. Another example a cone, which will have two faces and a single edge.
5 N" L- ^ C4 h5 gThe examples show how to access the following relationships:
" e' L2 v/ I4 mNX session → list of parts4 X/ j. ~3 x3 N: T, {: m) @
part → list of solid bodies
" j( q3 W& q$ fsolid body → list of faces
# L! f7 k8 N1 h% G( ^4 X% Q7 v; osolid body → list of edges/ j ~- _* q( n( J& M y3 Z
face → list of associated edges
9 Z. G' i; X: k6 a- c E$ iface → solid body4 j; K% j3 A0 F: m8 k# ^; V) Z
edge → list of associated faces( h1 M) K+ Z/ K8 m# Z7 o
edge → solid body# [ c* R6 ~* `" ~; d4 G8 h+ C
Bodies, Faces and Edges - Language Specific Details
$ v2 B5 _4 E0 v4 O* q/ d+ q% DNX Open for C++; Q* `$ A8 _2 M& x5 n0 T
NX Open for .NET
" } U6 _& y2 o3 v8 ANX Open for Java
, e' l9 b! W) ]/ @4 s: r0 V% c2 bNX Open for C++- w) v# t0 W2 B- ~* l
NX session → list of parts
/ A1 L0 f+ b2 q1 V; E' V" j+ XTo access all parts in an NX session, use the Parts property to access the Part Collection. Then use the collection's iterator to access each part.
2 {0 i7 H4 ^) |' _7 x Session *NXSession = Session::GetSession(); 4 f# [- v: C5 i+ I4 U
PartCollection *partList = NXSession->Parts();
: i' r8 m" \, X# H) g! d+ O PartCollection::iterator itr;
! R" w, K( ?6 [- n+ e$ r for ( itr = partList->begin(); itr != partList->end(); ++itr )
& i9 N/ c* I M# `" d* h {
0 h& U" n$ i$ t. o7 t: H! I; r processPart(*itr);
: S J* V4 Y3 `: Y9 [ }% e0 R3 F a" D
part → list of solid bodies0 q. J2 e1 _1 G0 w ?# A
To access all solid bodies in a part, use the Bodies property to access the Body Collection. Then use the collection's iterator to access each body.
4 @5 o$ [7 ]) i8 L% l" {void processPart(Part *partObject); Q, r7 [$ K9 `) W* R
{" t2 u- O5 Z/ k7 @6 r* X' k
BodyCollection *bodyList = partObject->Bodies();
8 w" ?; y \1 l) z BodyCollection::iterator itr;
" i+ Z4 `, D6 A& i% c( o for (itr = bodyList->begin(); itr != bodyList->end(); ++itr)
1 y( l, h9 _6 W7 P {
4 w8 X' o: c, o9 ?/ Z processBodyFaces(*itr);! P# x$ i6 m# B2 ^& p5 t# M5 P- u
processBodyEdges(*itr);8 C8 y# Z! T8 |
}
5 G, } b* ?& Q2 T' p6 K' r}# Q& {6 u0 K4 m, l- C. N
solid body → list of faces
8 E- K. Q; b1 l/ s# FTo access the faces of a body use the GetFaces() method to return an array of faces.4 b: A2 `8 ^' \( @. r- v
void processBodyEdges(Body *bodyObject)5 y8 I# M1 D# ]
{) K3 J* E5 `$ U; h
std::vector <Edge *> edgeArray = bodyObject->GetEdges();
$ K; {5 g" L( `3 G, V }5 A for (int inx = 0; inx < (int)edgeArray.size(); ++inx)# e8 x) p7 F7 e; @" r N/ `
{
0 K' P* |2 |9 _; ~' x processEdge(edgeArray[inx]);& _# q9 ]9 L2 w. ^' J2 f
}6 S- U5 m8 ]7 M6 |2 V: H4 |9 b
} solid body → list of edges
) |# O6 N3 w1 q, k0 hTo access the edges in a body use the GetEdges() method to return an array of edges.
) c( n! Q, h$ S) ivoid processBodyEdges(Body *bodyObject)
6 f8 D( T \0 H$ J{
9 o" Z% r/ `2 }# [ std::vector <Edge *> edgeArray = bodyObject->GetEdges();/ L2 K7 c" h( {, o, Z( x
for (int inx = 0; inx < (int)edgeArray.size(); ++inx)
. e* C6 K4 E6 k2 b e/ ~ {
$ s. g% [2 X6 s: X( o processEdge(edgeArray[inx]);% O+ Q6 n; W% e! ?3 J
}
3 o* g8 a7 @, B* y. C+ Y7 e8 b$ ^} face → list of associated edges
2 n8 W* {5 N3 O fface → solid body K# R9 I5 h1 N W" G6 U( t% z
To access the edges for a face use the GetEdges() method to return an array of edges. To access the face's body use the GetBody() method.
& I( X4 o* u1 N, nvoid processFace(Face *faceObject)1 @' { D- b H! y8 z4 x3 Y
{
! Z7 D$ F, d0 F2 p n' J- x" I. O# Q std::vector<Edge *> edgeArray = faceObject->GetEdges();) s2 J3 v8 ^7 o5 N+ u2 r: n
for (int inx = 0; inx < (int)edgeArray.size(); ++inx)
/ w4 T: h9 z9 V |% _ {
- `6 c$ b' R. W: H! v2 w processEdge(edgeArray[inx]);/ x4 f+ z: Z: ?, [) S& j
}
& \& u; Y' D1 @; j* _* X Body *bodyOfFace = faceObject->GetBody();
# W5 S: r, `' a' c} edge → list of associated faces9 A5 }' U1 d8 Q$ p2 Z
edge → solid body
4 `5 f3 g& D- b% o( P# E7 N6 @- JTo access the faces associated with and edge use the GetFaces() method to return an array of faces. To access the edge's body use the GetBody() method.& {% ?) h7 o5 F. \1 S: B* F2 }; V
void processEdge(Edge *edgeObject)
7 p1 l* [/ D3 ]! J5 c) ?& Q# f8 L; h! _, W{2 e, w& ~6 }) L" W6 C( Q& C
std::vector<Face *> faceArray = edgeObject->GetFaces();3 W7 P! n' c1 [' t2 L* W5 R! f; B* c
for (int inx = 0; inx < (int)faceArray.size(); ++inx)9 ~0 W, l) V, M0 N+ E5 o8 S2 Y) r
{+ t" ]" ~: A' p1 a% { {
processEdgeFace(faceArray[inx]);. f' y: g6 d& e$ {1 Y( H
}
$ w! A% I1 H5 s ]; C. m' \ Body *bodyOfEdge = edgeObject->GetBody();/ }$ u- Y4 e/ j8 m; w
}NX Open for .NET' _, D* w N5 p- x
NX session → list of parts+ u b! N7 }( C* c. j
To access all parts in an NX session, use the Parts property to access the Part Collection. Then use a standard iterator method to access each part.2 }) H" f4 \; [+ @( W/ L' f
Dim NXSession As Session = Session.GetSession
; Q s2 w7 Y7 P& a For Each partObject As Part In NXSession.Parts()
% I5 V5 a( ~6 A' O processPart(partObject)8 o2 r" k& x' o* ]; e! S3 T7 F+ Y$ K
Next partObject
4 j5 N7 A" M% A( o# G2 I- N& b. x) Rpart → list of solid bodies) Y( t/ V- U! K5 l0 ]4 o/ Q7 _
To access all solid bodies in a part, use the Bodies property to access the Body Collection. Then cast the object to the generic Object class to access the face and edge methods.
4 w2 c8 T" J) uSub processPart(ByVal partObject As Part): I+ ~" y$ t8 ]! Y0 V/ K* S& o! G
For Each bodyObject As DisplayableObject In partObject.Bodies
/ h' Q, ^$ C/ i4 b7 D; ~) E processBodyFaces(CType(bodyObject, Object))7 X% D- k) ~/ c z5 a
processBodyEdges(CType(bodyObject, Object))
. W4 j( C( @7 ?9 a Next bodyObject
' M1 R1 t( n1 b! UEnd Sub* S+ a1 D( Q. o8 \! x0 M( u" ]
solid body → list of faces! W2 Q) O# H% p$ {* }! p9 D0 B; `
To access the faces of a body use the GetFaces() method to return an array of faces.6 }0 _( m" q& ^
Sub processBodyFaces(ByVal bodyObject As Object)+ A- |: w5 l7 \+ v$ D7 Y
For Each faceObject As Face In bodyObject.GetFaces()' I' `0 z! l( E% \8 \9 f) ?
processFace(faceObject)
) ?7 w9 g) r7 u' S$ [. L# K* ~& v Next faceObject
A( A- c- }8 v7 t+ vEnd Sub
$ I X1 b; ]; y+ X& Ksolid body → list of edges
; I% o& a$ C; U0 F7 S, m7 ~To access a the edges in a body use the GetEdges() method to return an array of edges.0 w+ O; Q: y9 k' q& u+ J7 K L
Sub processBodyEdges(ByVal bodyObject As Object): U5 P1 z& _ g1 y% t
For Each edgeObject As Edge In bodyObject.GetEdges()
& h7 u: m5 o' {, ?: k$ C) z+ L processEdge(edgeObject)
* \! A$ y# v0 R& Y Next edgeObject
6 M9 @8 J* _* U4 M! `" z$ {& b7 iEnd Sub- O7 F* P4 `2 n3 k
face → list of associated edges6 `! h* p8 x6 Y( L* B8 q
face → solid body ' E* [ b9 _! I
To access the edges for a face use the GetEdges() method to return an array of edges. To access the face's body use the GetBody() method.
! z3 `# l) ?. R& {8 D4 VSub processFace(ByVal faceObject As Face), }* o- c* [7 `# ~: l/ _
For Each edgeObject As Edge In faceObject.GetEdges()$ Z5 A1 N* C+ p0 S3 ~
processEdge(edgeObject)% |6 l% p7 a+ f2 F0 B
Next edgeObject% ~" x9 r1 P. }$ J
Dim bodyOfFace As Body = faceObject.GetBody(). z. m; e" @/ N4 W
End Sub8 f, O* T) Q/ R9 C% `
edge → list of associated faces
' |1 f* h. K! r; q. fedge -→ solid body
8 S m' K. B* L! ?To access the edges for a face use the GetEdges() method to return an array of edges. To access the face's body use the GetBody() method.8 m( }; Y9 C7 R
Sub processEdge(ByVal edgeObject As Edge)6 g7 X4 t/ w( D1 ]4 S
For Each faceObject As Face In edgeObject.GetFaces()
v& f' z" n3 q3 R. C2 D+ f processEdgeFace(faceObject)
- t4 ]! n4 L9 e% P4 C Next faceObject; Z/ v, j( q* }- v8 a
Dim bodyOfEdge As Body = edgeObject.GetBody()
/ _6 Z+ p; e/ z' u# C7 A. PEnd Sub
2 |8 v6 E X+ U, yNX Open for Java& m) G/ U, Y l7 T
NX session → list of parts m' V7 }( a; \ T0 u$ b s [
To access all parts in an NX session, use the "parts" property to access the Part Collection. Then use the collection's iterator to access each part.+ q" c$ V$ Y% y/ Y$ N- y# m; R
NXSession = (Session) SessionFactory.get("Session");
: X. C$ {2 z; y4 w2 z/ ? Part partObject;# Y8 r% D' T; J) P _
PartCollection partList = NXSession.parts();8 T# h3 j. R/ [2 n# | w
PartCollection.Iterator itr;6 x1 o6 Y! [) p
for (itr = partList.iterator(); itr.hasNext();)
4 M2 a4 P o0 _! a/ A, {/ C- p {
' U) d$ h1 I6 m) t# v a; y partObject = (Part) itr.next();
) u+ x' m0 [" ]( H processPart(partObject);
+ _6 R9 {" N* g7 R }
! I5 A5 Q' f! y+ zpart → list of solid bodies( M* ]" |/ u6 s- a3 r* ]0 P% g5 c! k
To access all solid bodies in a part, use the "bodies" property to access the Body Collection. Then use the collection's iterator to access each body.
$ M/ o+ c0 E J" Zpublic static void processPart(Part partObject)
. R' X/ k- @# t( A v) U$ C1 ]{
# U8 ]( A/ i. s! f BodyCollection bodyList = partObject.bodies();; c W6 U+ W5 r$ T
BodyCollection.Iterator itr;
; l8 {- Q5 z) d L8 T5 A# O for (itr = bodyList.iterator(); itr.hasNext();)
0 P2 z3 A0 ~" i8 i { - d" `9 a- f# g- K% S
Body bodyObject = (Body) itr.next();
" Q' O, a p& C: j processBodyFaces(bodyObject); 6 ~3 q; C. \6 G- v2 R; @
processBodyEdges(bodyObject); 6 ?( |! P/ O* O. r/ b0 K2 J
} 7 c% H- O; S* t
}0 W) [; I9 g" f7 J* g0 }! s6 q
solid body → list of faces
1 a# j# O; R8 S% LTo access the faces of a body use the getFaces() method to return an array of faces.0 `% Y. C" d2 `3 K: G: K
public static void processBodyFaces(Body bodyObject) & t* S1 e$ ]; g# F* t
{7 f, w) R8 }7 Q' C3 W
Face faceArray[] = bodyObject.getFaces();
: J$ J9 X7 Q8 Q7 T2 A" |* q: Q& n+ o7 K for (int inx=0; inx <(int)faceArray.size(); ++inx)4 R2 _! J" R9 [# \* Q9 H
{
3 @( N4 N$ W0 c: f; K% e! P! c processFace(faceArray[inx]);
: ?/ J; f: r$ u* Q( V/ z8 W: H P }( R9 e9 i t; }& ~: G
}
! T ]+ P/ b8 a5 Zsolid body → list of edges
2 O) v0 L- _! j" }! ZTo access a the edges in a body use the getEdges() method to return an array of edges.3 M( u/ h/ y' J( m2 B9 ^4 _
public static void processBodyEdges(Body bodyObject)
9 b$ t' V, w3 @ r& a, a! n/ C9 h{ 2 Q' `2 _& A& ^( T+ d& N* t" L
Edge edgeArray[] = bodyObject.getEdges();
. L5 C$ t" C: n
" ]/ C5 l5 w2 V* B for (int inx = 0; inx < edgeArray.length; ++inx)
$ g% a) G& X7 w |5 p {
4 q. L V0 N9 j processEdge(edgeArray[inx]); J0 z) r. F( [$ T. q
}
- E: \8 }; D3 b) N% r4 ^( G. j# S}
' c" }5 }/ c+ N0 M2 L
7 u% q3 {2 Q4 P) U2 k" Nface → list of associated edges
+ x7 o4 W6 {9 g9 {face → solid body $ A8 m5 F- M# F. f& R
To access the edges for a face use the getEdges() method to return an array of edges. To access the face's body use the getBody() method.
- n- X* G, d# i4 Wpublic static void processFace(Face faceObject) 1 W3 a+ N; }1 s$ r( g) [5 G+ ~
{
- t# o) N' [+ \0 d Edge edgeArray[] = faceObject.getEdges();
$ h4 h X& d/ s, f
9 y) j7 ?6 ]+ k for (int inx=0; inx < edgeArray.length; ++inx)0 C E, n4 p4 D/ A( y0 }9 S$ Y
{ . @, H9 z, \' `" N ~! M4 u
processEdge(edgeArray[inx]);
7 S9 l* B- y$ P: |! [! `6 x8 H3 q }
- K9 a5 _: G. q' |
$ l3 r0 K7 w F! L8 K1 A f0 t Body bodyOfFace = faceObject.getBody();
* {8 A7 ?& G; f1 @}
+ f |5 w; o1 f3 `( r. zedge → list of associated faces3 G' z# m1 s# G0 @" t) _
edge → solid body
* ^ N6 s6 q, nTo access the faces associated with and edge use the getFaces() method to return an array of faces. To access the edge's body use the getBody() method.( C6 M- n# F6 P
public static void processEdge(Edge edgeObject) " Q7 Z0 B0 r! c# U$ p3 t
{
0 h7 {- G/ l7 H, n Face faceArray[] = edgeObject.getFaces();
. O* v. c. E, M. m for (int inx=0; inx <faceArray.length; ++inx)
( y: P' q/ m- n) |4 I { " q8 v. J& j- K8 O: N0 q2 K; Y& y
processEdgeFace(faceArray[inx]); $ P/ w: y1 @! P% p3 R1 I ~
}
1 o0 N) C. C0 | Body bodyOfEdge = edgeObject.getBody(); + X7 h. l7 @: u/ P: O5 _
} |
|