查看单个帖子
旧 2009-05-04, 05:36 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】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());
}
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)