static void ROYMyTest_Test2(void) { // Add your code for command ROYMyTest._Test2 here ads_name ssName; long ssLength; if (acedSSGet(_T("A"),NULL,NULL,NULL,ssName)!=RTNORM || acedSSLength(ssName,&ssLength)!=RTNORM) return; AcDbObjectId EntID; ads_name eName; AcDbEntity *pEnt; AcDbExtents extent; AcGePoint3d MaxPt,MinPt; Adesk::Boolean isFirstSet=Adesk::kTrue; for (long i=0;i<ssLength;i++) { if (acedSSName(ssName,i,eName)!=RTNORM || acdbGetObjectId(EntID,eName)!=Acad::eOk || acdbOpenAcDbEntity(pEnt,EntID,AcDb::kForRead)!=Acad::eOk) continue; if (pEnt->getGeomExtents(extent)!=Acad::eOk) { pEnt->close(); continue; } pEnt->close(); if (isFirstSet) { MaxPt=extent.maxPoint(); MinPt=extent.minPoint(); isFirstSet=Adesk::kFalse; } else { if (MaxPt.x<extent.maxPoint().x) MaxPt.x=extent.maxPoint().x; if (MaxPt.y<extent.maxPoint().y) MaxPt.y=extent.maxPoint().y; if (extent.minPoint().x<MinPt.x) MinPt.x=extent.minPoint().x; if (extent.minPoint().y<MinPt.y) MinPt.y=extent.minPoint().y; } } acedSSFree(ssName);
acedCommand(RTSTR,_T("ZOOM"), RTSTR,_T("W"), RTPOINT,asDblArray(MinPt), RTPOINT,asDblArray(MaxPt), RTNONE); } |