几何尺寸与公差论坛------致力于产品几何量公差标准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)
-   -   【转帖】cant update a viewport, invalid execution (http://www.dimcax.com/hust/showthread.php?t=15377)

yang686526 2009-05-04 05:36 PM

【转帖】cant update a viewport, invalid execution
 
can't update a viewport, invalid execution
can't update a viewport, invalid execution
in our software i create a new layout in a drawing. in the layout i create a viewport in order to display some model space data. but the problem is that i can't get the vieport to display anything. if i save the drawing and open it again the viewport works fine. i have tried to call oddbviewport->updatedisplay after i have created it but i get the following assertion:
source\database\entities\dbviewport.cpp
line: 1335
expression: invalid execution
does anyone know how to update a viewport without closing the file and open it again?
hi,
next piece of code appends new viewport to the paper space and adds appropriate view to gs device (it works fine with dd v1.14):
code:
// pdevice - pointer that setupactivelayoutviews() has returned for this database
odgspaperlayouthelperptr ppshelper = odgspaperlayouthelper::cast(pdevice);
if(ppshelper.get()) // we are in the paper space
{
oddbviewportptr pvp = oddbviewport::createobject();
pvp->setheight(10);
pvp->setwidth(15);
pvp->zoomextents();
odgicontextfordbdatabaseptr pctx = ppshelper->usergicontext();
odgsclientviewinfo viewinfo;
pctx->fillgsclientviewinfo(pvp->objectid(), viewinfo);
odgsviewptr pview = ppshelper->createview(&viewinfo);
ppshelper->addview(pview);
ppshelper->initgsview(pview, pvp);
pview->add(pctx->database()->getmodelspaceid().safeopenobject(), ppshelper->gsmodel());
}


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