void CrtLaVp(double dH, double dW, AcGePoint2d maxExt, AcGePoint2d minExt, bool bInsert)
{
AcApLayoutManager* pLayM = (AcApLayoutManager*)acdbHostApplicationServices()->layoutManager();
ACHAR* nextLayoutName = pLayM->getNextNewLayoutName(NULL);
AcDbObjectId layoutId = AcDbObjectId::kNull;
AcDbObjectId btrId = AcDbObjectId::kNull;
//bCreatViewPort = pLayM->createViewports();
pLayM->setCreateViewports(Adesk::kFalse);
pLayM->createLayout(nextLayoutName, layoutId, btrId);
pLayM->setCurrentLayout(nextLayoutName);
pLayM->updateCurrentPaper();
AcDbViewport* pVp = new AcDbViewport;
// Append new viewport to paper space
AcDbBlockTableRecord* pBTR;
if (acdbOpenObject(pBTR, btrId, AcDb::kForWrite) != Acad::eOk)
{
acutPrintf(L"\nCannot access paper space.");
delete pVp;
return;
}
AcDbObjectId idViewPort = AcDbObjectId::kNull;
if (pBTR->appendAcDbEntity(idViewPort, pVp) != Acad::eOk)
{
acutPrintf(L"\nCannot append viewport to paper space.");
pBTR->close();
delete pVp;
return;
}
pBTR->close();
AcGePoint3d centerPointPos(120, 100,0);
AcGePoint2d ViewCenter(0,0);
AcGeVector3d v(-1, -1, 1);
AcGePoint3d modelCenter(0, 0, 0);
pVp->setCenterPoint(centerPointPos);
pVp->setViewDirection(v);
pVp->setViewCenter(ViewCenter);
pVp->setViewTarget(modelCenter);
pVp->setViewHeight(100);
pVp->setHeight(dH);
pVp->setWidth(dW);
pVp->setOn();
pVp->showHiddenLines();
pVp->close();
Acad::ErrorStatus es;
AcDbObjectId vsId = AcDbObjectId::kNull;
const ACHAR* szVisStyleName = acdbGetReservedString(AcDb::kVSRealistic, false);
es = AcDbDictUtil::getVisualStyleId(vsId, szVisStyleName, acdbCurDwg());
int vpNum = -1;
AcDbViewport* pViewport;
if ((es = acdbOpenObject(pViewport, idViewPort, AcDb::kForWrite)) == Acad::eOk)
{
vpNum = pViewport->number();
pViewport->setViewTarget(modelCenter);
pViewport->setVisualStyle(vsId);
pViewport->close();
}
void ads_regen();
ads_regen();
}