void CDrawTu::CreateSK() { // 指定当前布局 Acad::ErrorStatus es = acdbHostApplicationServices()->layoutManager() ->setCurrentLayout(_T("布局1")); if (es != Acad::eOk) { return; } // 获得块表 AcDbBlockTable *pBlkTbl; acdbHostApplicationServices()->workingDatabase() ->getBlockTable(pBlkTbl, AcDb::kForRead); // 获得图纸空间的块表记录 AcDbBlockTableRecord *pBlkTblRcd; pBlkTbl->getAt(ACDB_PAPER_SPACE, pBlkTblRcd, AcDb::kForWrite); pBlkTbl->close(); // 创建新的布局对象 AcDbViewport *pViewport = new AcDbViewport(); pViewport->setCenterPoint(AcGePoint3d(50, 50, 0)); pViewport->setHeight(80); pViewport->setWidth(120); // 将新的布局对象添加到图纸空间块表记录中 AcDbObjectId viewportId; pBlkTblRcd->appendAcDbEntity(viewportId, pViewport); pViewport->close(); pBlkTblRcd->close(); // 将新建的视口作为当前视口 AcDbViewport *pVP; acdbOpenObject(pVP, viewportId, AcDb::kForWrite); pViewport->setOn(); int vpNum = pViewport->number(); pVP->close(); acedCommand(RTSTR, _T("_PSPACE"), 0); es = acedSetCurrentVPort(pVP); acedCommand(RTSTR, _T("_ZOOM"), RTSTR, _T("_Extents"), 0); } 以上代码实现了创建新视口 但是没能实现缩放 而且原有视口如何删除 请各位高手指点一下 |