Bob is spot on with his solution above.
If you only need to do it for two objects, you can also use the
ConnectObjects
function with the two objects as variables.
Here's small script that shows how it can be done.
It reads the first object from a specific table and the first object from the current selection and uses these two objects for the analysis:
Fetch First From Highways_Buffer_2500m
Dim oBuffer As Object
oBuffer = Highways_Buffer_2500m.OBJ
Fetch First From Selection
Dim oPolygon As Object
oPolygon = Selection.OBJ
Dim oLine As Object
oLine = ConnectObjects(oBuffer, oPolygon, 0) '0 indicates to use the farthest distance, 1 the shortest
Print "Distance: " + FormatNumber$(Round(ObjectLen(oLine, "m"), 1)) + " meters"
Insert Into WindowInfo(FrontWindow(), WIN_INFO_TABLE)
(OBJ)
Values (oLine)
The script does a bit more than necessary as it also inserts the calculated line into the map window. This is purely so that you can control if it looks fine.
------------------------------
Peter Horsbøll Møller
Principal Presales Consultant | Distinguished Engineer
Precisely | Trust in Data
------------------------------
Original Message:
Sent: 09-30-2022 05:28
From: Martin Burroughs
Subject: Farthest extent of buffer
Hi,
I've got a polygon, and a buffer around the polygon.
I need to figure out the furthest distance from a point on the polygon boundary to a point on the buffer boundary. All suggestions welcome!
------------------------------
Martin Burroughs
Oldham Council
------------------------------