private int Compare(Point3d point, BlockReference br, double radius)
{
Database db = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database;
Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
bool intersect = false;
using (Transaction trans = db.TransactionManager.StartTransaction())
{
BlockTableRecord btr = trans.GetObject(br.BlockTableRecord,OpenMode.ForRead) as BlockTableRecord;
//BlockTableRecord modelBTR = trans.GetObject(db.CurrentSpaceId, OpenMode.ForWrite) as BlockTableRecord;
Matrix3d brTransformedCoord = br.BlockTransform;
foreach (ObjectId objId in btr)
{
DBObject obj = trans.GetObject(objId, OpenMode.ForWrite);
if ((obj is Entity) && (!(obj is DBText)) && (!(obj is MText)) && (!(obj is Hatch)) && (!(obj is Spline)))
{
Entity ent = (Entity)obj;
Entity tempEnt = ent;
tempEnt.TransformBy(brTransformedCoord);
Point3dCollection pts = new Point3dCollection();
//Plane pl = new Plane();
Circle pointCircle = new Circle(point, new Vector3d(0, 0, 1), radius);
//modelBTR.AppendEntity(pointCircle);
//trans.AddNewlyCreatedDBObject(pointCircle, true);
try
{
tempEnt.IntersectWith(pointCircle, Intersect.OnBothOperands, pts, IntPtr.Zero, IntPtr.Zero);
}
catch (Autodesk.AutoCAD.Runtime.Exception ex)
{
// MessageBox.Show(ex.Message + ex.Source + "\n");
}
if (pts.Count > 0)
intersect = true;
//pointCircle.Erase();
}
}
trans.Commit();
}
if (intersect == true)
return 0;
return -1;
}