Is there a method to find all text elements near a certain distance from a specified point? Thanks.
Solved! Go to Solution.
you can use selection filter base on entity and co-ordinate. you can go through below links:
// Start Transaction
using (Transaction tr = db.TransactionManager.StartTransaction())
{
BlockTableRecord modelSpace = (BlockTableRecord)tr.GetObject(
SymbolUtilityServices.GetBlockModelSpaceId(db), OpenMode.ForRead);
foreach (ObjectId id in modelSpace)
{
// Pick only Leaders
if (id.ObjectClass.DxfName == "LEADER")
{
// Pick only HOMES
Leader leader = (Leader)tr.GetObject(id, OpenMode.ForRead);
if (leader.Layer == "HOMES")
{
// Leader Points (Just use the last point)
Point3dCollection pts = new Point3dCollection();
leader.GetStretchPoints(pts); // NOTE: pts will have all the points of the leader
// HERE I would call a method
// that would get all text elements within a certain distance of: pts[pts.Count-1] <<The last point of the leader
You might write some code that test object locations within a area.
I just wrote one my self using the region test based on a idea of Tony T.
However i changed the code to do simple inside polygon tests because i needed more speed and my area's are simple 2D rectangles.
Thanks everyone. Also I found this:
http://www.stormconsultancy.co.uk/blog/development/code-snippets/the-haversine-formula-in-c-and-sql/
"Haversine Formula"
I think it might help me.