[每日一码] UCS点是否在屏幕显示
UCS不与屏幕平行时可以这样BOOL ptInView(AcGePoint3d pt)
{
resbuf rb;
acedGetVar(采用T("SCREENSIZE"),&rb);
CRect CADrect;
acedGetAcadDwgView()->GetClientRect(CADrect);
int num=acedGetWinNum(CADrect.left,CADrect.top);
AcGeMatrix mat;
acedGetCurrentUCS(mat);
mat.inverse();
pt.transformBy(mat);
CPoint cp;
acedCoordFromWorldToPixel(num,asDblArray(pt),cp);
return (cp.x<0 | cp.y<0 | cp.x>rb.resval.rpoint | cp.y>rb.resval.rpoint) ? FALSE : TRUE;
}
页:
[1]