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