odabstractviewpe::zoomextents does not work on this dwg
odabstractviewpe::zoomextents does not work on this dwg
hello,
the following piece of code appears to not work properly with the attached dwg.
the purpose is to zoom-extent the dwg and then save it as a bmp ( the code is derived from your ddtest.cpp sample application, that you sent me a while ago )
all the operations must be done without any displayed window ( so i am attempting to create a zoom-extended bmp file starting from a dwg )
the code is:
odint32 width = (odint32)(1024);
odint32 height = (odint32)(768);
odgsmoduleptr m;
if (bmpdevice == gdi_device || bmpdevice == gdi_device_al)
{
m = :

drxdynamiclinker()->loadmodule("bmpmodule_gdi");
}
odgsdeviceptr pdevice = m->createdevice();
if (pdevice.get())
{
odgsdcrect gsrect(0, width, height, 0);
odgicontextfordbdatabaseptr pctx = odgicontextfordbdatabase::createobject();
pctx->setdatabase(pdb);
pdevice = oddbgsmanager::setupactivelayoutviews(pdevice, pctx);
pdevice->setbackgroundcolor(isdwf ? dwfclrbackground : clrbackground);
pdevice->setlogicalpalette(odcmacadpalette( isdwf ? dwfclrbackground : clrbackground), 256 );
pdevice->onsize(gsrect);
pdevice->properties()->putat("bitperpixel", odrxvariantvalue(oduint32(8)));
try
{
pdevice->update();
}
catch(...)
{
std::cout << "exception in pdevice->update()\n";
}
// world extents to view cs:
odgsview* pview = pdevice->viewat(0);
odgeboundblock3d ext;
if( pview ) {
odabstractviewpeptr pvppe(pview);
odgeboundblock3d bbox;
bool bbboxvalid = pvppe->viewextents(pview, bbox);
pvppe->zoomextents(pview, &bbox);
}
the code is similar to that used in the odamfcapp sample - the odamfcapp sample zoom-extents correctly the dwg - this sample not
anyway, the major difference is that in my case i don't have any opened window
please help.
if the issue is not trivial, i can also send you the whole project
regards,
ciro ettorre
attached files
you can close the issue
i fixed it by adding:
pdevice->onsize(gsrect);
pdevice->update();
after the
pvppe->zoomextents(pview, &bbox);
ciro