Jump to content


LISP CENTERLINE on layer


  • You cannot reply to this topic
No replies to this topic

#1 JIM78B

    Member

  • Members
  • PipPip
  • 14 posts

Posted 24 April 2020 - 07:49 AM

hello please i nedd modify this lisp so create a centerline on a layer that i have or if there is not present in the drawing will create it and then return on current layer...layer 0

;;--------------------=={ Centerline }==----------------------;;
;;														    ;;
;;  Creates a pair of centerlines for Arcs, Circles, Ellipses ;;
;;  and Elliptical arcs with a user-defined length and angle. ;;
;;------------------------------------------------------------;;
;;  Author: Lee Mac, Copyright © 2013 - www.lee-mac.com	   ;;
;;------------------------------------------------------------;;
;;  Version 1.2    -    13-08-2013						    ;;
;;------------------------------------------------------------;;
(defun c:cline ( / ang dis ent pt1 pt2 )
    (if
	    (and
		    (progn
			    (while
				    (progn (setvar 'errno 0) (setq ent (car (entsel "\nSelect Arc, Circle or Ellipse: ")))
					    (cond
						    (   (= 7 (getvar 'errno))
							    (princ "\nMissed, try again.")
						    )
						    (   (= 'ename (type ent))
							    (if (not (wcmatch (cdr (assoc 0 (entget ent))) "CIRCLE,ARC,ELLIPSE"))
								    (princ "\nInvalid Object Selected.")
							    )
						    )
					    )
				    )
			    )
			    (= 'ename (type ent))
		    )
		    (setq pt1 (trans (cdr (assoc 10 (entget ent))) ent 1))
		    (setq pt2 (getpoint "\nSpecify Length & Direction of Centreline: " pt1))
		    (setq ang (angle pt1 pt2)
				  dis (distance pt1 pt2)
		    )
	    )
	    (repeat 2
		    (entmake
			    (list
				   '(0 . "LINE")
				    (cons 10 (trans (polar pt1 ang dis) 1 0))
				    (cons 11 (trans (polar pt1 ang (- dis)) 1 0))
			    )
		    )
		    (setq ang (+ ang (/ pi 2.0))
				  dis (- dis)
		    )
	    )
    )
    (princ)
)
(princ)






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users