iCAx开思网

标题: 【求助】如何遍历ug装配得到零件的body? [打印本页]

作者: netroamer    时间: 2004-5-31 09:06
标题: 【求助】如何遍历ug装配得到零件的body?
先得到装配的所有child occurrences,然后得到occurrence的prototype,然后调用函数UF_OBJ_cycle_objs_in_part遍历所有的solid实体,可是有的零件能返回实体的tag,有的返回为空,请问这是怎么回事?
作者: zzz    时间: 2004-5-31 09:19
这种问题十有八九是你的程序的问题,把你的程序发上来看看。
作者: netroamer    时间: 2004-5-31 09:40
程序如下,其中asm_t是装配
tag_t *child_components = NULL;
int component_count = UF_ASSEM_ask_part_occ_children( asm_t, [$child_components )]
  
for( int i=0; i<component_count; i++ )
{
    tag_t prototype = UF_ASSEM_ask_prototype_of_occ( child_components );
  
    tag_t BodyTag = NULL_TAG;
    while(TRUE)
    {
        //遍历所有体
        UF_OBJ_cycle_objs_in_part (prototype, UF_solid_type, [$BodyTag)]
        if (BodyTag == NULL_TAG)
            break;
    }
}
  
程序应该没有问题,因为大部分装配都能得到零件的body,少数零件没有,会不会是因为装配环境下零件只是部分载入?有什么办法解决吗?谢谢!
作者: my_dear2002    时间: 2008-8-28 11:00
tag_t prototype = UF_ASSEM_ask_prototype_of_occ( child_components );
这句有问题的吧,是不是tag_t prototype = UF_ASSEM_ask_prototype_of_occ( child_components ); )


原帖由 netroamer 于 2004-5-31 09:40 发表
程序如下,其中asm_t是装配
tag_t *child_components = NULL;
int component_count = UF_ASSEM_ask_part_occ_children( asm_t, [$child_components )]
  
for( int i=0; i<component_count; i++ )
{
  ...





欢迎光临 iCAx开思网 (https://www.icax.org/) Powered by Discuz! X3.3