AcDbBlockTable *pBlkTbl;
AcDbBlockTableRecord *pBlkTblRcd;
acdbHostApplicationServices()->workingDatabase()
->getBlockTable(pBlkTbl, AcDb::kForRead);
pBlkTbl->getAt(ACDB_MODEL_SPACE, pBlkTblRcd,
AcDb::kForRead);
pBlkTbl->close();
/ /获得当前图形中所有实体的最小包围盒
AcDbExtents extent;
extent.addBlockExt(pBlkTblRcd);
pBlkTblRcd->close();
// 计算长方形的顶点
ads_point pt[7];
pt[0][X] = pt[3][X] = pt[4][X] = pt[7][X] = extent.minPoint().x;
pt[1][X] = pt[2][X] = pt[5][X] = pt[6][X] = extent.maxPoint().x;
pt[0][Y] = pt[1][Y] = pt[4][Y] = pt[5][Y] = extent.minPoint().y;
pt[2][Y] = pt[3][Y] = pt[6][Y] = pt[7][Y] = extent.maxPoint().y;
pt[0][Z] = pt[1][Z] = pt[2][Z] = pt[3][Z] = extent.maxPoint().z;
pt[4][Z] = pt[5][Z] = pt[6][Z] = pt[7][Z] = extent.minPoint().z;
acedGetVar(_T("EXTMAX"),&rb1);//获取当前图形的右上角点坐标
acedGetVar(_T("EXTMIN"),&rb2);//获取当前图形的左下角点坐标
AcGePoint3d maxPt;
AcGePoint3d minPt;
maxPt[X]=rb1.resval.rpoint[X];
maxPt[Y]=rb1.resval.rpoint[Y];
minPt[X]=rb2.resval.rpoint[X];
minPt[Y]=rb2.resval.rpoint[Y];
maxPt[Z]=minPt[Z]=0;