(defun C:MEXTEND()
  (graphscr)
  (setvar "cmdecho" 0)
  (setvar "blipmode" 0)
  (setvar "pickbox" 3)
  (prompt "\nSelect the extend edge(s) !")
  (setq edge (ssget))
  (prompt "\nSelect objects to extend by CROSSING...")
  (setq p1 (getpoint "\n Enter the 1st point : "))
  (setq p2 (getcorner p1 "\n Enter the 2nd point : "))
  (setq s (ssget "c" p1 p2))
  (command "extend" edge "")
  (setq i 0)
  (setvar "pickbox" 1)
  (repeat (sslength s)
    (cond
      ((not (ssmemb (ssname s i) edge))
        (setq t (entget (ssname s i)))
        (setq tp1 (cdr (assoc 10 t)))
        (setq tp2 (cdr (assoc 11 t)))
        (setq ip (inters p1 p2 tp1 tp2))
        (if (not (null ip)) (command ip))
      )
    )
    (setq i (1+ i))
  )
  (command "")
  (setvar "pickbox" 3)
  (princ)
)
