void createVport()
{
acedCommand(RTSTR,"MSPACE",0);
AcDbObjectId originVportId = acedGetCurViewportObjectId();
acedCommand(RTSTR,"PSPACE",0);
if(originVportId != NULL)
{
AcDbViewport* pViewport;
acdbOpenAcDbEntity((AcDbEntity *&)pViewport,originVportId,AcDb::kForWrite);
pViewport->erase();
pViewport->close();
}
double viewPortHeight;
double viewPortWidth;
ads_name entlast;
ads_entlast(entlast);
acedCommand(RTSTR,"-VPORTS",RTSTR,"F",0);
if(ads_entnext(entlast,entlast) == RTNORM)
{
AcDbObjectId vportId;
acdbGetObjectId(vportId,entlast);
///设置视口
AcDbViewport* pVport;
acdbOpenAcDbEntity((AcDbEntity *&)pVport,vportId,AcDb::kForWrite);
pVport->setCustomScale(1);
pVport->setViewCenter(AcGePoint2d(viewPortWidth/2,viewPortHeight/2));
pVport->setCenterPoint(AcGePoint3d(viewPortWidth/2,viewPortHeight/2,0));
pVport->setHeight(viewPortHeight);
pVport->setWidth(viewPortWidth);
pVport->close();
}
}