查看单个帖子
旧 2009-05-05, 11:14 AM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】get entents of a xref

get entents of a xref
get entents of a xref
i am trying to get entents of a xref. if i put the xref the same directory as the master file, i am ok. if the xref is in a network drive (e.g. \\sps200\templates\border_0.dwg), i can't use oddbblockreference::getgeomextents() to get the extents. by the way, i can see the xref is properly loaded in the file.
// the blockid is the xref id
//blockname is the xref name
oddbblocktablerecordptr pms = blockid.safeopenobject();
oddbobjectiteratorptr pentiter;
for(pentiter = pms->newiterator(); !pentiter->done(); pentiter->step())
{
oddbentityptr pent = pentiter->entity(oddb::kforread);
oddbblockreferenceptr pref = oddbblockreference::cast(pent);
if (!pref.isnull())
{
oddbblocktablerecordptr pblock = pref->blocktablerecord().safeopenobject();
strcpy(test, pblock->getname());
if (_stricmp(pblock->getname(), blockname) == 0)
{
scale3d = pref->scalefactors();
if ( pref->getgeomextents(ext) != eok )
continue;
}
}
}
scalefactors() returns the right scale. however, the getgeomextents doesn't return eok,
is this a bug of the lib or i am doing something wrong.
thanks,
al
i made a mistake when i posted the message. the blockid is the modelspace block id from the drawing. so my code looks like:
// the blockid is the modelspace id
//blockname is the xref name
oddbblocktablerecordptr pms = blockid.safeopenobject();
oddbobjectiteratorptr pentiter;
for(pentiter = pms->newiterator(); !pentiter->done(); pentiter->step())
{
oddbentityptr pent = pentiter->entity(oddb::kforread);
oddbblockreferenceptr pref = oddbblockreference::cast(pent);
if (!pref.isnull())
{
oddbblocktablerecordptr pblock = pref->blocktablerecord().safeopenobject();
strcpy(test, pblock->getname());
if (_stricmp(pblock->getname(), blockname) == 0)
{
scale3d = pref->scalefactors();
if ( pref->getgeomextents(ext) != eok )
continue;
}
}
}
scalefactors() returns the right scale. however, the getgeomextents doesn't return eok.
thanks,
al
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)