public static bool IsInBuildingRegion(Entity ent, ObjectIdCollection boundaries, Transaction tr)
{
bool valid = false;
if (ent is Curve)
{
Curve pline = ent as Curve;
Point2dCollection points = new Point2dCollection();
points.Add(new Point2d(pline.GeometricExtents.MaxPoint.X, pline.GeometricExtents.MaxPoint.Y));
points.Add(new Point2d(pline.GeometricExtents.MinPoint.X, pline.GeometricExtents.MinPoint.Y));
foreach (ObjectId boundaryId in boundaries)
{
Polyline boundary = (Polyline)tr.GetObject(boundaryId, OpenMode.ForWrite, false, true);
foreach (var point in points)
{
if (IsPointInPolygon(boundary, point))
{
valid = true;
}
}
}
}
return valid;
}