 ; VBL - Left rejustify a column of text.  Change existing entities rather
 ; than replacing them - useful when style, layer etc. must be preserved.
 ; Copyright 1995 by Rocket Software
 ;
 (DEFUN C:VBL ( / ss xa num txa aa yy ll sp)
  (setvar "cmdecho" 0)
  (command "undo" "mark")
  (prompt "Pick text/attdefs to left justify: ")
  (if (setq ss (ssget '((-4 . "<or")
                        (0 . "text")
                        (0 . "attdef")
                        (-4 . "or>"))))
      (progn
           (setq xa (car (getpoint "\nPick start:")))
           (setq num 0)
           (while (setq enam (ssname ss num))
                  (setq num (1+ num))
                  (setq entt (entget enam))
                  (setq typ (cdr (assoc 0 entt)))
                  (setq ll (cons xa (cddr (assoc 10 entt))))
                  (setq entt (subst (cons 10 ll) (assoc 10 entt) entt))
                  (if (= typ "ATTDEF")
                      (setq entt (subst (cons 74 0) (assoc 74 entt) entt))
                      (setq entt (subst (cons 73 0) (assoc 73 entt) entt)))
                  (entmod (subst (cons 72 0) (assoc 72 entt) entt)))
           (setq sp (if (= (setq num (sslength ss)) 1) "" "s"))
           (prompt (strcat "\n" (itoa num) " line" sp " rejustified.")))
           (prompt "\nNo text selected."))
 (princ))