取得选择集包围盒
BOOL GetSSExtents(ads_name ss, ads_point &maxpt, ads_point &minpt)
{
long len;
int ret=ads_sslength(ss,&len);
if(ret!=RTNORM||len<1) return FALSE;
AcDbObjectId objId;
ads_name ename;
AcDbEntity *pEnt;
AcDbExtents extent;
AcGePoint3d pt1,pt2;
ads_ssname (ss, 0, ename);
acdbGetObjectId(objId,ename);
acdbOpenObject(pEnt,objId,AcDb::kForRead);
pEnt->getGeomExtents(extent);
pt1=extent.maxPoint();
pt2=extent.minPoint();
pEnt->close();
for(int i=0;igetGeomExtents(extent);
if(pt1[X]extent.minPoint()[X]||pt2[Y]>extent.minPoint()[Y])
pt2=extent.minPoint();
pEnt->close();
}
maxpt[X]=pt1[X];
maxpt[Y]=pt1[Y];
maxpt[Z]=pt1[Z];
minpt[X]=pt2[X];
minpt[Y]=pt2[Y];
minpt[Z]=pt2[Z]; return TR; }
|