Hi,
this is very quick and dirty routine almost not tested
but seems to be work on the first glance
Select both lines and arcs by window or by other method
Let me know when you will be found something wrong there
Code:
(defun C:ALE (/ *error* acsp adoc arc arc_list i lay line line_list ss
tmp)
(if (< (atoi (substr (getvar "acadver") 1 2)) 15)
(progn
(alert
"Program will be works starting\n
from A2000 and higher ..."
)
(exit)
(princ)
)
)
(or (vl-load-com))
(defun *error* (msg)
(princ msg)
(vla-endundomark
(vla-get-activedocument
(vlax-get-acad-object)
)
)
(princ)
)
(or adoc
(setq adoc (vla-get-activedocument
(vlax-get-acad-object)
)
)
)
(or acsp
(setq acsp (if (= (getvar "CVPORT") 1)
(vla-get-paperspace
adoc
)
(vla-get-modelspace
adoc
)
)
)
)
(vla-endundomark
adoc
)
(vla-startundomark
adoc
)
(setq ss (ssget (list (cons 0 "LINE,ARC"))))
(setq i 0)
(vlax-for a (vla-get-activeselectionset adoc)
(if (eq "AcDbLine" (vla-get-objectname a))
(setq line_list (cons a line_list))
(setq arc_list (cons a arc_list))
)
)
(setq lay (vla-get-layer (car arc_list)))
(foreach arc arc_list
(setq tmp
(vl-remove-if
(function not)
(mapcar
(function
(lambda (x)
(vlax-invoke arc 'Intersectwith x acextendnone)
)
)
line_list
)
)
)
(setq tmp
(vl-sort tmp
(function (lambda (p q)
(<= (vlax-curve-getparamatpoint
arc
(vlax-curve-getclosestpointto arc p)
)
(vlax-curve-getparamatpoint
arc
(vlax-curve-getclosestpointto arc q)
)
)
)
)
)
)
(mapcar (function (lambda (m n)
(progn
(setq line (vlax-invoke acsp 'Addline m n))
(vla-put-layer line lay)
)
)
)
tmp
(cdr tmp)
)
)
(foreach arc arc_list
(vla-delete arc)
)
(*error* nil)
(princ)
)
(prompt "\n\t\t***\tType ALE to execute...\t***\n")
(princ)
~'J'~