![]() |
【转帖】layout geometry extents
layout geometry extents
layout geometry extents i am trying to vectorize all of the geometry in a layout, regardless of whether it is in the view or not. most of my layouts come across fine, but some are defined with outlying geometry that zoomextents does not pick up. here is the code i am using: layout = pdb->findlayoutnamed(layoutname); pdb->setcurrentlayout(layout); oddblayoutptr playout = layout.safeopenobject(); id = playout->overallvportid(); if (id) { oddbviewportptr pvp = id.safeopenobject(oddb::kforwrite); pvp->zoomextents(); } the layouts that i am having a problem with in the attached file are pfc-030, pfc-035 and pfc-110. all are defined badly, but i need all of the geometry anyway. unfortunately, the forum database is not letting me upload the sample file directly, so you can download it from the link is not working for me... sergey slezkin quote: originally posted by sergey slezkin the link is not working for me... stupid linux system.... had to be all lowercase. scott i seem to have reproduced the problem in odamfcapp: open the file in odamfcapp view/setactivelayout pfc-30 or pfc-35 edit/zoom extents vectorize the screen is empty. gs zoom extents works correctly. we'll look into it and let you know results. it seems to be a dd bug. sergey slezkin quote: originally posted by sergey slezkin i seem to have reproduced the problem in odamfcapp: open the file in odamfcapp view/setactivelayout pfc-30 or pfc-35 edit/zoom extents vectorize the screen is empty. gs zoom extents works correctly. we'll look into it and let you know results. it seems to be a dd bug. any progress on this? my customer is quite anxious on this one. hi, it's a bug and it has been fixed. you can use next code as workaround: code: oddblayoutptr playout = pdb->currentlayoutid().safeopenobject(); oddbviewportptr pvp = playout->overallvportid().openobject(oddb::kforwrite); if (pvp.get()) { odabstractviewpeptr pviewpe(pvp); odgeboundblock3d ext; if(pviewpe->viewextents(pvp, ext)) { odgepoint3d min = ext.minpoint(), max = ext.maxpoint(); // clip huge extents if(min.x < -10e100) min.x = -10e100; if(min.y < -10e100) min.y = -10e100; if(min.z < -10e100) min.z = -10e100; if(max.x > 10e100) max.x = 10e100; if(max.y > 10e100) max.y = 10e100; if(max.z > 10e100) max.z = 10e100; odgepoint3d viewtarg = pviewpe->target(pvp); odgevector3d viewdir = pviewpe->direction(pvp); odgematrix3d xeyetoworld = pviewpe->eyetoworld(pvp); // set target to center of the scene, keeping view direction: odgepoint3d newtarg = xeyetoworld * (min + (max - min) / 2.0); if(pviewpe->isfrontclipon(pvp) || pviewpe->isbackclipon(pvp)) { // keeping distance from target to front & back planes newtarg = newtarg.orthoproject(odgeplane(viewtarg, viewdir)); } double fw = ext.maxpoint().x - ext.minpoint().x; double fh = ext.maxpoint().y - ext.minpoint().y; // fit width if(odnonzero(fh) && odnonzero(pvp->width()) && odnonzero(pvp->height())) { if(pvp->width() / pvp->height() < fw / fh) { fh *= (fw / (pvp->width() / pvp->height() * fh)); } } pviewpe->setview(pvp, newtarg, viewdir, pviewpe->upvector(pvp), fw * 1.02, fh * 1.02, pviewpe->isperspective(pvp)); } } |
| 所有的时间均为北京时间。 现在的时间是 12:11 AM. |