Turn ELLIPSE To Polyline

Free Lisps

Powered By Clickbank Ad Rotator

With this Lisp you can turn ann ELLIPSE thhat you already created to a Polyline

The reason to do this, is if you need to set a width to the Ellipse, something that you can not do with a real Ellipse

 

(defun c:e2p( /
old new ;existent and new polyline
sav ;store system variables
cen ;center of ellipse
dep ;axis end point deplacement (relative to cen)
p1 p2 ;first axis enpoints
p3 ;sec. axis endpoint
)
(setq old (car (entsel “\n select ellipse to change “)))
(while old
(if (= (cdr (assoc 0 (entget old))) “ELLIPSE”)
(progn
(setq sav (mapcar ‘getvar ‘(“PELLIPSE” “OSMODE” “UCSICON”))
cen (cdr (assoc 10 (entget old)))
dep (cdr (assoc 11 (entget old))))
(mapcar ‘setvar ‘(“PELLIPSE” “OSMODE” “UCSICON”) ‘(1 0 0))
(command “UCS” “e” old)
(setq p1 (trans (list (+ (car cen) (car dep))
(+ (cadr cen) (cadr dep))
(+ (caddr cen) (caddr dep)))
0 1)
p2 (trans (list (- (car cen) (car dep))
(- (cadr cen) (cadr dep))
(- (caddr cen) (caddr dep)))
0 1)
p3 (trans (polar cen
(+ (/ PI 2.0) (angle p1 p2))
(* 0.5 (cdr (assoc 40 (entget old))) (distance p1 p2)))
0 1)
)
(command “ellipse” p1 p2 p3)
(setq new (entget (entlast))
new (subst (cons 8 (cdr (assoc 8 (entget old)))) (assoc 8 new) new))
(entmod new)
(entdel old)
(command “ucs” “p”)
(mapcar ‘setvar ‘(“PELLIPSE” “OSMODE” “UCSICON”) sav)
)
(alert “This is not a spline ellipse!”)
)
(setq old (car (entsel “\n next ellipse -or none for exit “)))
)
(princ)
)


Powered By Clickbank Ad Rotator

Recommended Clickbank Products