原帖地址:http://www.ugufun.com/?p=1315 p# b0 @ J J2 |
v# V, Y# M- b1 O1 N0 t+ J2 t
所有的ug对象类型都通过它们唯一的标识tag来引用,这些UG对象分类如下:
" ^3 v# ^; t* v! r9 U( f' u- u! z$ ~! B4 e& C, F8 U
Parts9 \6 O l. C# I; R( O; d: N
UF objects(uf_object_types.h中说明的)- M( {1 v& c, p! I) R8 ?4 w
Expressions(表达式)
, Q" }9 t! h1 j: @对每一类对象,都有UG/OPEN API中明确的函数对它们进行操作。. B4 h$ v# k6 r" L: y
+ b; p6 p4 O8 o
Parts2 I2 I: K: {- L) v# V8 l" `# c
对每一个加载到UG环境中的part文件,都有一个关联的part object代表它, 也为每一个part object分配一个tag(标记符)。
3 G) s \! B5 s! o5 k& }$ o: D1 R
( @* i4 c2 _6 E0 d1 `( G! x1 c+ x一个UG part 文件 (以 .prt 扩展名的二进制文件) 是UF objects, expressions, and Parasolid objects永久保存之地。另外UG part 文件还包含下列内容:- w1 b& y E: n' H/ t! Y5 n) z
" f! H9 G) k- e2 e/ h6 j$ }# h O
创建part的计算机类型
7 V( @, t- `" y/ w+ r' R- |保存part的UG版本2 b* b4 {! Z6 h5 }( U8 n
part的历史 (i.e. a log of when the part was saved, by what program, etc.)8 y% D" ^* t9 u, m8 H
状态、描述和用户区的可永久保存在part文件中的信息。
; M5 t: h8 `; |在part中查询objects。
3 N! _6 N( {' [3 v$ d1 ?对Parts操作的函数6 c. N9 u8 q J/ o
UF_OBJ_cycle_objs_in_part' x8 b" }( W6 p" T# V/ ?+ E0 ?
- d' C* a" [4 d! C访问part的属性。
3 x9 g3 l4 a- R% s/ n* OUF_ATTR_ask_part_attrs
" ~. L3 b# D2 U. K' M" _9 l0 B
) l: }& K5 T0 r+ c3 n1 p关闭和再打开part。. C+ a$ w4 x/ H* |& m' w
UF_PART_close 和 UF_PART_reopen/ `- {% O" l1 }1 D
/ p+ W6 n. J; @8 `8 Z获取part的文件名。
8 F& K) V; o& f/ j! X5 KUF_PART_ask_part_name
/ G( c8 ?7 Y0 X
# X; J4 e) H, C' V. i" A, n查询其它信息。" h; a; e# M }& Y, [0 Q
UF_PART_ask_customer_area, UF_PART_ask_description, UF_PART_ask_status
& i% D! ^' t& n( ]. r/ Q2 o
+ N9 P6 g( ?" s, j" W) ]设置状态、描述等信息。7 Q: j0 n' i, ^; h! M
UF_PART_set_customer_area, UF_PART_set_description, UF_PART_set_status1 t9 y. t. H, Z% D* }+ f$ q- O2 j
; _ y: j2 z7 H! g9 [查询part的历史。
0 ?& F: s/ q F) }8 AUF_PART_ask_part_history 等 N6 n9 \) g, o/ p7 v( F, X) X
# E" `5 m8 N7 C& O3 [
compressing parts。
a: y5 U I( e+ A% R, A0 z4 [3 x$ U, sUF_PART_ask_compression_flags 和 UF_PART_set_compression_flags0 N8 E9 w, P% B# _! `0 f1 ~8 _4 ^, W
9 _& w. c& M( y. s
装配意义下的part对象( t$ z; \1 {7 ], i3 m8 j
装配概念和术语
& z4 _: g- R w0 v! \( O在装配环境中总保持只有一个part是当前活动的,它叫work part. 用户创建的所有UF对象、表达式等都是在work part中创建。
. J r% \, V7 M1 V8 s$ A2 G( @ D& g5 y! {2 T; ^
此外还有一个叫display part的概念. 在UG的某一应用(如Modeling)时display part 和 work part 可以不同。5 r3 \, F2 j8 Y
3 z8 [7 N$ M3 X一个装配件(assembly part)包含components(组件). Components 是其它的UG的parts 并且这些parts可以被装配在它们自己中。
# f o4 q. @1 ?: u* W% G( t V+ ]
) Y$ B) q8 x5 K8 z. d$ a1 x Z" B$ UComponents 通过 instances 在 assembly 中存在。 instance 描述component在assembly中的方位(父子关系)。
9 N" n0 c! |, t
2 J9 i, |6 a# s! h r4 O- a例如: if we have a car that has two axle sub-assemblies (a front and a rear) and each axle sub-assembly has two wheels (a left and a right), then the car assembly has two instances of the axle sub-assembly, and the axle sub-assembly has two instances of wheel. The instances of the axle sub-assembly in the car describe how to position the axles in the car. The instances of the wheels in the axle sub-assembly describe how to position the wheels in the axle sub-assembly.# n! O* E. {* \4 U
. s4 K- k* X! p: x另外还有part occurrences。part occurrence 描述在全局的assembly中怎样定位一个单独的component。# u( b" b" M: h! [& z; }0 I3 h
4 Z A/ X: t- x7 R0 x4 JFor example: in the car assembly above, there would be four part occurrences for the wheels. The part occurrence in the car for the right front wheel would be created from the combination of the orientation of the front axle to the car and the orientation of the right wheel to the axle.
: f8 m8 ^; i6 k0 w
. k" b# \8 X/ x& r5 `" ^$ KInstances 和 part occurrences 也是由tags标识。 特别地,它们是UG对象中UF object中的part类: instance 是 UF_occ_instance_type,part occurrence是UF_component_type,UF_part_occurrence_subtype.因此, instance和part occurrences 共享 适用于 UF objects的函数。
+ |0 A( `6 n L: M" P+ h( R+ s5 Z+ j( f, b/ u5 I
$ W5 g8 t5 W' Y9 A% o' {
* t9 a. ]% {$ M* x% ^8 v. d
查询display part 或 work part 。6 S( Y* G3 c. E: ]* S, h) K
UF_PART_ask_display_part 和 UF_ASSEM_ask_work_part
W3 X9 f8 q6 L4 i, C9 t; D4 z) T: {3 U& F
设置 display part 或 work part 。
0 A: b. g0 ~7 F' lUF_PART_set_display_part 和UF_ASSEM_set_work_part
/ u: y+ N, U* C! p! R- ?
2 b1 } X4 d3 PThese routines set the display or work part. There is a side effect when the display part is set and restrictions on setting the work part:& U2 H0 D- r9 \( |! t- G
& {7 j9 E/ E4 S& H8 |8 S) r% w( D* A! ~% M1 w
As a byproduct of setting the display part, Unigraphics resets the work part at the same time. There is one exception to this rule: if the new display part contains the old work part and the Retain Work Part assembly preference is set, the work part does not change as a result of this action.& M) H9 ~, M+ U" M3 P+ N. R
You are not allowed to set the work part in interactive Unigraphics while in certain application modules. If an application module does not support setting the work part in interactive Unigraphics, you cannot set the work part using UF_ASSEM_set_work_part.
. C* P5 `9 q H$ r$ o增加一个 part 到一个 assembly中。
9 ^3 C; q# D+ o3 U2 r3 m2 @UF_ASSEM_add_part_to_assembly [对存在的part] 或 UF_ASSEM_create_component_part [对新的 part]
- Q' U% H& e* \* D4 g# O
8 G9 H5 ?+ G# r+ w从一个 occurrence tag 得到part tag。
" C- W! O$ U9 b8 P+ ^UF_ASSEM_ask_prototype_of_occ1 ?$ w* G% z* p& m: x$ h) G
$ n( T$ B; b: k D) d( _* _- A8 u在一个part中查找 instances。
' b$ ~6 |* X2 ]UF_ASSEM_cycle_inst_of_part) j" d* Q( h& t' _, m3 H
|