From: ยทยทยทยท@excite.com
Subject: Changing parallel lines into a single line
Date: 
Message-ID: <1119040467.006493.7660@g47g2000cwa.googlegroups.com>
Found a script that will do the above but deletes the parallel lines.
I have tried to make it run without deleting the lines but nothing has
worked.
Any help is appreciated.


(defun avg2 (a b)
  (/ (+ a b) 2.0))


;;singln - Replaces parallel lines with a single line.
(defun c:singln ( / ss e1 e2 ei ei2 p1 p2 p3 p4)
  (and
    (princ "\nSelect 2 parallel lines: ")
    (setq ss (ssget (list (cons  0 "line"))))
    (setq e1 (ssname ss 0))
    (setq e2 (ssname ss 1))
    (setq ei (entget e1))
    (setq ei2 (entget e2))
    (setq p1 (cdr(assoc 10 ei)))
    (setq p2 (cdr(assoc 11 ei)))
    (setq p3 (cdr(assoc 10 ei2)))
    (setq p4 (cdr(assoc 11 ei2)))
    (or
      (< (distance p1 p3)(distance p1 p4))
      (setq pt p3 p3 p4 p4 pt))
    (entmod
      (list
        (cons -1 e1)
        (cons 10 (mapcar 'avg2 p1 p3))
        (cons 11 (mapcar 'avg2 p2 p4)))) 
    (entdel e2)) 
  (princ))