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

getgeomextents not working
getgeomextents not working
i am trying to get the true extents of the geometry in the model and paper space views. i can go into autocad and figure out the true extents, but the value returned by getgeomextents is not the same as the true extents. this is true even if i do a zoomextents first.
i would have thought this was a fairly simple and common operation.
i am using:
oddbobjectid msid = pdb->getmodelspaceid();
oddbblocktablerecordptr pblock = msid.safeopenobject();
odgeextents3d extents;
pblock->getgeomextents(extents);
am i doing something wrong?
hi,
dd (just like autocad) uses different code for calculating extents in getgeomextents() and in active view when you choose "zoom extents", it's because of that second extents depend on view and viewport settings.
to calculate view extents you should use:
code:
odrxobjectptr pview = ...; // get view object
// pview should be either oddbviewporttablerecord or oddbviewport or corresponding odgsview.
odabstractviewpeptr pvppe(pview);
odgeboundblock3d bbox;
bool bbboxvalid = pvppe->viewextents(pview, bbox); // ext in eye cs
if(bbboxvalid )
{
// extents not empty
bbox.trasformby(pvppe->eyetoworld(pview)); // wcs (either paper or model)
}
else
{
// empty
}
see cdwgviewer:nviewzoomextents() in odamfcapp for more info.
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)