学习UG,把tag的意义忘掉,你只需要知道的是tag是一个整数。猜测tag只会让你误入歧途。作者: supergirl 时间: 2005-4-21 20:26
在UG中,用于标识对象的变量tag_t在当前session中是固定不变的,但part被保存并重新载入后,所有对象的tag_t值会重新排定,所以它并不是固定不变的。在UG中还有一种对象标识EID,这个EID被存储在part文件中,在下次打开时该对象标识是不变的。在UFun中用句柄handle表示。
函数extern char * UF_TAG_ask_handle_of_tag (tag_t object_tag )用于获取对象tag_t所对应的句柄handle。
函数extern tag_t UF_TAG_ask_tag_of_handle (char * object_handle )用于获取句柄handle的tag_t值。作者: mcwind 时间: 2005-4-21 21:28
楼上的mm懂得还真多啊...作者: miraculous 时间: 2005-4-22 10:24
谢谢楼上的各位
后来我写了个代码,验证了一下,对一个part文件保存前与保存后后两次读取:
第一次
RootPart Part tag is 123, Part name is F:\UG\work\temp.prt, Object tag is 10
Part occur tag is 106, Part name is F:\UG\work\matrix.prt, Object tag is 13, Inst tag is 116, Inst Name is MATRIX2
Part occur tag is 100, Part name is F:\UG\work\punch.prt, Object tag is 15, Inst tag is 114, Inst Name is PUNCH
Part occur tag is 110, Part name is F:\UG\work\matrix.prt, Object tag is 13, Inst tag is 113, Inst Name is MATRIX
第二次
RootPart Part tag is 495, Part name is F:\UG\work\temp.prt, Object tag is 13
Part occur tag is 499, Part name is F:\UG\work\matrix.prt, Object tag is 15, Inst tag is 489, Inst Name is MATRIX2
Part occur tag is 508, Part name is F:\UG\work\punch.prt, Object tag is 10, Inst tag is 491, Inst Name is PUNCH
Part occur tag is 507, Part name is F:\UG\work\matrix.prt, Object tag is 15, Inst tag is 510, Inst Name is MATRIX
在此过程中,Object标识是不变的,而事例标示却发生了变化作者: miraculous 时间: 2005-4-22 12:54
另外对对象句柄也进行了一下验证,发现实际情况就如supergirl所说:
第一次
RootPart Part tag is 123, Part name is F:\UG\work\temp.prt, Object tag is 10
Part occur tag is 106, Part name is F:\UG\work\matrix.prt, Object tag is 13, Inst tag is 116, Inst Name is MATRIX2, Handle is RMtemp.prt O0000009400000002
Part occur tag is 100, Part name is F:\UG\work\punch.prt, Object tag is 15, Inst tag is 114, Inst Name is PUNCH, Handle is RMtemp.prt O0000004000000001
Part occur tag is 110, Part name is F:\UG\work\matrix.prt, Object tag is 13, Inst tag is 113, Inst Name is MATRIX, Handle is RMtemp.prt O0000001600000001
第二次
RootPart Part tag is 495, Part name is F:\UG\work\temp.prt, Object tag is 13
Part occur tag is 499, Part name is F:\UG\work\matrix.prt, Object tag is 15, Inst tag is 489, Inst Name is MATRIX2, Handle is RMtemp.prt O0000009400000002
Part occur tag is 508, Part name is F:\UG\work\punch.prt, Object tag is 10, Inst tag is 491, Inst Name is PUNCH, Handle is RMtemp.prt O0000004000000001
Part occur tag is 507, Part name is F:\UG\work\matrix.prt, Object tag is 15, Inst tag is 510, Inst Name is MATRIX, Handle is RMtemp.prt O0000001600000001
注意到前后两次Handle没有变化作者: miraculous 时间: 2005-4-22 12:55
另外对对象句柄也进行了一下验证,发现实际情况就如supergirl所说:
第一次
RootPart Part tag is 123, Part name is F:\UG\work\temp.prt, Object tag is 10
Part occur tag is 106, Part name is F:\UG\work\matrix.prt, Object tag is 13, Inst tag is 116, Inst Name is MATRIX2, Handle is RMtemp.prt O0000009400000002
Part occur tag is 100, Part name is F:\UG\work\punch.prt, Object tag is 15, Inst tag is 114, Inst Name is PUNCH, Handle is RMtemp.prt O0000004000000001
Part occur tag is 110, Part name is F:\UG\work\matrix.prt, Object tag is 13, Inst tag is 113, Inst Name is MATRIX, Handle is RMtemp.prt O0000001600000001
第二次
RootPart Part tag is 495, Part name is F:\UG\work\temp.prt, Object tag is 13
Part occur tag is 499, Part name is F:\UG\work\matrix.prt, Object tag is 15, Inst tag is 489, Inst Name is MATRIX2, Handle is RMtemp.prt O0000009400000002
Part occur tag is 508, Part name is F:\UG\work\punch.prt, Object tag is 10, Inst tag is 491, Inst Name is PUNCH, Handle is RMtemp.prt O0000004000000001
Part occur tag is 507, Part name is F:\UG\work\matrix.prt, Object tag is 15, Inst tag is 510, Inst Name is MATRIX, Handle is RMtemp.prt O0000001600000001
注意到前后两次Handle没有变化作者: miraculous 时间: 2005-4-22 12:55
另外对对象句柄也进行了一下验证,发现实际情况就如supergirl所说:
第一次
RootPart Part tag is 123, Part name is F:\UG\work\temp.prt, Object tag is 10
Part occur tag is 106, Part name is F:\UG\work\matrix.prt, Object tag is 13, Inst tag is 116, Inst Name is MATRIX2, Handle is RMtemp.prt O0000009400000002
Part occur tag is 100, Part name is F:\UG\work\punch.prt, Object tag is 15, Inst tag is 114, Inst Name is PUNCH, Handle is RMtemp.prt O0000004000000001
Part occur tag is 110, Part name is F:\UG\work\matrix.prt, Object tag is 13, Inst tag is 113, Inst Name is MATRIX, Handle is RMtemp.prt O0000001600000001
第二次
RootPart Part tag is 495, Part name is F:\UG\work\temp.prt, Object tag is 13
Part occur tag is 499, Part name is F:\UG\work\matrix.prt, Object tag is 15, Inst tag is 489, Inst Name is MATRIX2, Handle is RMtemp.prt O0000009400000002
Part occur tag is 508, Part name is F:\UG\work\punch.prt, Object tag is 10, Inst tag is 491, Inst Name is PUNCH, Handle is RMtemp.prt O0000004000000001
Part occur tag is 507, Part name is F:\UG\work\matrix.prt, Object tag is 15, Inst tag is 510, Inst Name is MATRIX, Handle is RMtemp.prt O0000001600000001