[Search tip detail and code files using keywords, tip number, author name, etc ]
    For tip to function correctly, you must ensure that the downloaded file name matches the file name
    displayed in the Rename File To field. Please rename downloaded files when necessary.
Find the Fermat Point
Tip# 4053 By Owen Protheroe On 19-Jan-2013
Rated By 0 users Downloaded : 150
Categories : 2D Operations, Inquiry
Software type : AutoCAD 2013
Rename File To : FP.LSP
Find the point that is located the shortest distance from three other points.

This is a neat AutoCAD routine from Owen Protheroe that allows you to join any three points with the shortest path. What exactly does that mean? Think of the three points as vertices of a triangle, and you may realize that what this LISP routine actually does is find the Fermat point of any triangle. It is very easy to use: load the LISP file, type in the command FP, and pick three points. Three lines will be constructed, and the intersection of these lines is the result.


Average Rating:

User comments
Comment by Cooper,Kent
Posted on 2013-01-20 18:13:06
This subject came up on the AutoCAD Customization discussion group recently. FP.lsp above doesn't account for the fact that if any of the internal angles of the triangle formed by the three points is equal to or greater than 120 degrees, then the Fermat point is AT that point, and the Fermat "tree" connecting them with the shortest total distance has only two Lines. The User would need to be aware that if the three Lines drawn don't all intersect, the Fermat point is the User point at one end of the Line that doesn't intersect the other two, the end closer to the intersection of the other two. For a routine that DOES take this into account, and draws the actual Fermat Tree (the Lines making up the shortest total distance, not extending past each other, rather than the longer Lines), see the FT3.lsp routine in Message 10 at http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/Steiner-Tree-Problem/m-p/3696178/highlight/true#M307484 . (There's also one on that thread that works for 4 points, within certain limitations on their relationship.)

Log In