.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Finding text elements near to the specified point

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
autogis
568 Views, 6 Replies

Finding text elements near to the specified point

Is there a method to find all text elements near a certain distance from a specified point?  Thanks.

6 REPLIES 6
Message 2 of 7
mzakiralam
in reply to: autogis
Message 3 of 7
_gile
in reply to: mzakiralam

Doesn't the Leader.Annotation property help ?



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 4 of 7
autogis
in reply to: _gile

The text objects I am trying to find are actually separate elements.  They are not part of the leader:  leaderAndText.png

Message 5 of 7
autogis
in reply to: autogis

// 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

Message 6 of 7
SENL1362
in reply to: autogis

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.

 

 

Message 7 of 7
autogis
in reply to: SENL1362

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.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost