(defun c:df() 
       (setq clay (getvar "clayer"))
       (setq pp (entsel "\nPlease select a line"))
       (setq sp (cadr pp))
       (setq mn (car pp))
       (setq sn (entget mn))
       (setq spx (car sp))
       (setq p1 (cdr (assoc 10 sn)))
       (setq p2 (cdr (assoc 11 sn)))
       (setq p1 (trans p1 0 1))
       (setq p2 (trans p2 0 1))
       (setq p1x (car p1))
       (setq p2x (car p2))
       (if (> p1x p2x) (progn (setq uu1 p1x uu2 p2x)
                              (setq p1x uu2 p2x uu1)
                              (setq uu3 p1 uu4 p2)
                              (setq p1 uu4 p2 uu3)
                        )
        )
       (setq mpx (+ p1x (/ (- p2x p1x) 2)))
       (cond ((> spx mpx) (progn (setq gg1 (polar p2 (/ pi -2) 17.95))
                                 (setq gg2 (polar gg1 pi 0.8))
                                 (setq gg3 (polar gg2 (/ pi -2) 3.5))
                                 (setq gg4 (polar gg3 0 0.8))
                                 (setq gg5 (polar gg1 (/ pi -2) 1))
                                 (setq gg7 (polar gg1 0 3.2))
                                 (setq gg8 (polar gg1 0 6.5))
                           ))
             ((< spx mpx) (progn (setq gg1 (polar p1 (/ pi -2) 17.95))
                                 (setq gg2 (polar gg1 0 0.8))
                                 (setq gg3 (polar gg2 (/ pi -2) 3.5))
                                 (setq gg4 (polar gg3 pi 0.8))
                                 (setq gg5 (polar gg1 (/ pi -2) 1))
                                 (setq gg7 (polar gg1 pi 3.2))
                                 (setq gg8 (polar gg1 pi 6.5))
                            ))
          )
         (setq gg6 (polar gg4 (/ pi -2) 3))
         (command "-osnap" "none")
         (command "-layer" "s" "0" "")
         (setvar "dimfit" 3)
         (setvar "dimjust" 0)
         (setvar "dimtofl" 0) 
         (setvar "dimupt" 0)
         (setvar "dimtad" 1)
         (command "line" gg1 gg2 "")
         (setq hh1 (ssget "l"))
         (command "line" gg2 gg3 "")
         (command "line" gg3 gg4 "")
         (setq hh2 (ssget "l"))
         (command "trim" hh1 hh2 "" gg5 "")
         (command "-layer" "s" "1" "")
         
         
          (command "-layer" "s" clay "")
          (command "osmode" "39")
          (princ)
     )




;(command "dimlinear" gg3 gg4 "h" gg6)
         (cond ((> spx mpx) (progn 
                      (command "dimlinear" p2 gg1 "v" gg7)
                      (command "dimlinear" p2 gg4 "v" gg8)
                     ))
                ((< spx mpx) (progn 
                        (command "dimlinear" p1 gg1 "v" gg7)
                        (command "dimlinear" p1 gg4 "v" gg8)
                     ))
           )