This will get you started I hope
Works good for me in A2008eng
Code:
;; elb.lsp
;; load ActiveX dll
(vl-load-com)
;; local defun
;; get value by key
(defun dxf (key alist)
(cdr (assoc key alist))
)
;;================================ main programm ================================;;
(defun C:ELB (/ aep1 aep2 arc1 arc2 asp1 asp2 el1 el2 el3 el4 ep1 ep2 ep3
ep4 frad ip1 ip2 ln1 ln2 ln3 ln4 osm p1 p2 sp1 sp2 sp3 sp4 ss1 ss2 wid)
(setq osm (getvar "osmode"))
(setvar "osmode" 32)
(setq frad (getvar "filletrad"))
(setvar "cmdecho" 0)
(setq p1 (getpoint "\nPick intersection point of inner lines: "))
(setq ss1 (ssget "C" p1 p1 (list (cons 0 "LINE"))))
(if (/= (sslength ss1) 2)
(progn (exit) (princ)))
(setq ln1 (ssname ss1 0)
ln2 (ssname ss1 1)
el1 (entget ln1)
el2 (entget ln2)
sp1 (dxf 10 el1)
ep1 (dxf 11 el1)
sp2 (dxf 10 el2)
ep2 (dxf 11 el2)
ip1 (inters sp1 ep1 sp2 ep2 nil)
)
(setq p2 (getpoint "\nPick intersection point of outer lines: "))
(setq ss2 (ssget "C" p2 p2 (list (cons 0 "LINE"))))
(if (/= (sslength ss2) 2)
(progn (exit) (princ)))
(setq ln3 (ssname ss2 0)
ln4 (ssname ss2 1)
el3 (entget ln3)
el4 (entget ln4)
sp3 (dxf 10 el3)
ep3 (dxf 11 el3)
sp4 (dxf 10 el4)
ep4 (dxf 11 el4)
ip2 (inters sp3 ep3 sp4 ep4 nil)
)
(setq wid (* (distance ip1 ip2) (cos (/ pi 4))))
(setvar "filletrad" wid)
(command "fillet" ln1 ln2 "")
(setq arc1 (entlast))
(setq asp1 (vlax-curve-getstartpoint arc1)
aep1 (vlax-curve-getendpoint arc1)
)
(setvar "filletrad" (* wid 2.))
(command "fillet" ln3 ln4 "")
(setq arc2 (entlast))
(setq asp2 (vlax-curve-getstartpoint arc2)
aep2 (vlax-curve-getendpoint arc2)
)
(if (< (distance asp1 asp2) (distance asp1 aep2))
(progn
(command "line" "_non" asp1 "_non" asp2 "")
(command "line" "_non" aep1 "_non" aep2 "")
)
(progn
(command "line" "_non" asp1 "_non" aep2 "")
(command "line" "_non" aep1 "_non" asp2 "")
)
)
(setvar "cmdecho" 1)
(setvar "osmode" osm)
(setvar "filletrad" frad)
(princ)
)
(princ "\nStart command with ELB")
(princ)
~'J'~