几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   DirectDWG (http://www.dimcax.com/hust/forumdisplay.php?f=89)
-   -   【转帖】getgeomextents not working (http://www.dimcax.com/hust/showthread.php?t=16390)

yang686526 2009-05-05 11:22 AM

【转帖】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::onviewzoomextents() in odamfcapp for more info.


所有的时间均为北京时间。 现在的时间是 06:45 AM.