iCAx开思工具箱

标题: 关于Tag值的问题 [打印本页]

作者: miraculous    时间: 2005-4-20 23:16
标题: 关于Tag值的问题
请问在UG系统中给生成的线、面、实体分配的Tag值是不是有规律可循?线的Tag值位于一定范围内,而面的Tag值又位于另外的一个范围内?
除了编程查询的方法,有没有办法在UG中直接获得线、面、实体的Tag值呢?
谢谢!
作者: mizzle    时间: 2005-4-21 08:32
tag值是固定的,你可以查一下各类特征的tag值得定义,就可以知道了
作者: zhjb113    时间: 2005-4-21 19:00
tag是随机数,你不要理会他是多少。
如果你知道了tag的规律,你就错了。
如果你认为tag是固定的,那你就更错了。
  
如果你想得到一个对象的固定ID,你可以用handle。
  
学习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
  
注意到前后两次Handle没有变化
作者: leechongqing    时间: 2005-4-27 10:07
那么请教各位哥哥姐姐,如果不保存装配体,是不是tag_t就不会变化了呢?




欢迎光临 iCAx开思工具箱 (https://t.icax.org/) Powered by Discuz! X3.3