I added the following condition before the T condition. It uses the center of a circle as test point if one of the two objects is a circle.
AFAIK it's reliable and as expected it reduces the core function elapsed time to zero. On average it saves about 0.05 second. Obviously not worth the effort.
At the risk of repeating myself, though one method may prove faster than another, that does not always translate to a meaningful improvement. I would leave the code as is.
((setq pos (vl-position "AcDbCircle" (list typ1 typ2)))
(if (zerop pos)
(setq testpt (vlax-get obj1 'Center))
(setq testpt (vlax-get obj2 'Center))
)
(if (not (zerop pos))
;; Reverse the objects.
(setq temp obj1 obj1 obj2 obj2 temp)
)
(setq p1 (vlax-curve-GetClosestPointTo obj2 testpt)
pt (vlax-curve-GetClosestPointTo obj1 p1)
d (distance pt p1)
resdist d
)
)
One other thought. If anyone wants to post a new version it should be labeled as beta until others have a chance to test it.
Regards
Joe