Autocad Lisp

BY DEREJE KITAW
(DEFUN C:DER () ; Copy text [normally with snap modes enabled, this one is simplified] - By Brian Forbes - http://www.autolisp.org/
 (PRINC (SETQ CT (CDR (ASSOC 304 (setq ed (entget (car (entsel  "Select text to copy: "))))))))
  (while T (c:yt))
  (PRINC))
  (DEFUN C:YT () ; Paste text - By Brian Forbes - http://www.autolisp.org/
  (setq ed (entget (car (entsel   "\nSelect text to replace: "))))
  (entmod (subst (cons 304 CT) (assoc 304 ed) ed ) )
  (ENTUPD (CDR (CAR ED)))
)
;;;(defun c:1 ( )
;;;
;;;   (command "_vports" "r""1")
;;;)
;;;To turn off layer "Image"
(defun c:0 ( )
;;;   (command "_layoff" Layer "Image" "")
  (COMMAND".LAYER""OFF""Image""")
)
(defun c:00 ( )
;;;   (command "_layoff" Layer "Image" "")
  (COMMAND".LAYER""ON""Image""")
)
(defun c:zz ( )
  (command "_zoom" " ")
)
(defun c:dd ( )
  (command "_dimlinear")
)
(defun c:ddd ( )
  (command "_dimaligned")
)

(defun c:2 ( )
  (command "_vports" "r""2")
)
(defun c:3 ( )
  (command "_vports" "r""3")
)
(defun c:4 ( )
  (command "_vports" "r""4")
)
(defun c:11 ( )
  (command "_vports" "2""v")
)
(defun c:12 ( )
  (command "_vports" "2""H")
)
(defun c:jj ( )
  (command "_vports" "j")
)
(defun c:ww ( )
;;;  (setq p1 (getpoint "Press the mouse button: "))
;;;(setq p2 (getpoint "Press the mouse button: "))
   (setq p1 (list -0.897807 10.8014 0.0))
(setq p2 (list 49.4495 0.328282 0.0))
  (command "ZOOM" "w" p1 p2)
)
(defun c:www ( )
;;;  (setq p1 (getpoint "Press the mouse button: "))
;;;(setq p2 (getpoint "Press the mouse button: "))
;;;(command "Switching to: E>")
 
  (setq p1 (list 5.32917 3.55436 0.0))
(setq p2 (list 7.15791 3.16981 0.0))
  (command "ZOOM" "w" p1 p2)
)
(defun c:oo ( )
;;;   (command "_layoff" Layer "Image" "")
  (COMMAND".OFFSET""t")
)
(defun c:mm ( )
;;;   (command "_layoff" Layer "Image" "")
  (COMMAND".MATCHPROP")
)
(defun c:ll ( )
;;;   (command "_layoff" Layer "Image" "")
  (COMMAND".PLINE")
)
(defun c:cc ( )
  (COMMAND"_COPY")
)
(defun c:ff ( )
  (COMMAND"_layfrz")
)
(defun c:tt ( )
  (COMMAND"_TRIM")
)
(defun c:ee ( )
  (COMMAND"_EXTEND")
)
(defun c:hh ( )
;;;   (command "_layoff" Layer "Image" "")
  (COMMAND"_xline""Hor")
)
(defun c:vv ( )
;;;   (command "_layoff" Layer "Image" "")
  (COMMAND"_xline""Ver")
)
;;; By Tim Turner (10/05)
 (defun C:inc ()
   (setq init_str (getstring "\n Enter Initial Value:"))
   (setq inc (getint "\n Enter Increment:"))
   (setq init_val (atoi init_str))
   (setq init_val_str (itoa init_val))
   (setq suffix (vl-string-trim init_val_str init_str))
   (setq ss (ssget))
   (setq ent (entget (ssname ss 0)))
   (setq ent (subst (cons 1 init_str) (assoc 1 ent) ent))
   (entmod ent)
   (while 1
  (setq ss (ssget))
  (setq init_val (+ init_val inc))
  (setq inc_val (itoa init_val))
  (setq ent (entget (ssname ss 0)))
  (setq
    ent (subst (cons 1 (strcat inc_val suffix)) (assoc 1 ent) ent)
  )
  (entmod ent)
   )
 )

(defun c:mx (/ ss ptso ptd ptre xDist) ;Move along X axis only
  (setvar "cmdecho" 0)
  (setq ss (ssget))
  (setq ptso
  (getpoint
    "\n Select source point or Enter to type in distance along X axis"
  )
  )
  (if (null ptso)
    (progn
      (setq xDist (getdist "\nType in or pick points for distance ")
     ptso  (list 0.0 0.0 0.0)
     ptd   (list xDist 0.0 0.0)
      )
      (command ".move" ss "" "_non" ptso "_non" ptd)
      (princ)
    )
    (progn
      (setq ptre (getpoint "\n Select destination reference"))
      (setq ptd (list (car ptre) (cadr ptso) (caddr ptso)))
      (command ".move" ss "" "_non" ptso "_non" ptd)
      (setvar "cmdecho" 1)
      (princ)
    )
  )
)