Looking for a LISP to check if a line and an arc or two arcs are Tangent
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
We are looking for a LISP to check if a line meeting an arc/curve or an arc/curve meeting a reverse arc/curve are tangent. Searching through the archives here, I found something similar posted by BILLZ from 2005. It works perfect for Line to Arc but does not do Arc to Arc. I am posting his LISP below for reference and maybe someone can simply modify it. We are running 2008 Land Desktop Companion so we do no use Smart Draft.
Also, can the Pop Up Alert be changed to just show in the command prompt area?
As always, thank you guys so much.
Here's Billz's Code from 2005:
========================
(defun c:checktangent ();(/ Ar ArcEnt Ln LnEnt)
(vl-load-com)
;---;
(prompt "\nLine.")
(setq LnEnt (ssget "+.:E:S" '((0 . "LINE,POLYLINE,LWPOLYLINE")))
)
(prompt "\nArc or Circle.")
(setq ArEnt (ssget "+.:E:S" '((0 . "ARC,CIRCLE")))
)
;---;
(cond ((and LnEnt ArEnt)
(setq Ln (vlax-ename->vla-object (ssname LnEnt 0))
Ar (vlax-ename->vla-object (ssname ArEnt 0))
)
(if (and (vla-intersectwith Ln Ar acExtendBoth)
(= (length (vlax-safearray->list (variant-value (vla-intersectwith ln ar acExtendBoth)))) 3)
)
(alert "Line is tangent.")
(alert "Line is NOT tangent.")
)
)
(t (prompt "\nInvalid entities."))
)
(princ)
)