 ; Sundog - turn a cloud inside out.
 ; Copyright 1991, 1994, 2002, 2004 by Rocket Software Ltd.
 ; Draw a small cloud, turn it inside out.  Now the entire drawing is
 ; clouded.  Or the whole universe.
 (DEFUN C:SUNDOG (/ entt enam blg bulg asoc42 num sub gnuent)
  (setvar "cmdecho" 0)
  (command "undo" "be")
  (setq esav (setq enam (car (entsel "Select a polyline:\n"))))
  (setq entt (entget enam))
  (setq blg (getreal "New Bulge Factor (<Enter> = Reverse): "))
  (cond ((= (cdr (assoc 0 entt)) "POLYLINE")
         (while (/= (cdr (assoc 0 entt)) "SEQEND")
                (if (setq bulg (cdr (setq asoc42 (assoc 42 entt))))
                    (if blg
                        (entmod (subst (cons 42 blg) asoc42 entt))
                        (entmod (subst (cons 42 (- bulg)) asoc42 entt))))
                (setq entt (entget (setq enam (entnext enam)))))
         (entupd esav))
        ((= (cdr (assoc 0 entt)) "LWPOLYLINE")
         (setq num 0)
         (while (setq sub (nth num entt))
                (setq num (1+ num))
                (if (= (car sub) 42)
                    (if blg
                        (setq sub (cons 42 blg))
                        (setq sub (cons 42 (- (cdr sub))))))
                (setq gnuent (cons sub gnuent)))
         (entmod (reverse gnuent))
         (entupd esav))
        (t (write-line "That was not a polyline.")))
  (command "undo" "e")
 (princ))