;//Elise Moss ;//Moss Designs ;//12/30/98 ;//www.mossdesigns.com ;// ; *** JUSTIFY.LSP *** ; ; Changes the justification of text to:- ; Left, Center, Right, Aligned, Middle, Fit, ; Bottom left, center or right, ; Middle left, center or right, OR ; Top left, center of right ; (defun C:justify (/ a a1 a2 a3 a4 T1 m n n1 p1 p q j j0 n2 j1 j2 q1 index dummy) (setvar "cmdecho" 0) (graphscr) (prompt "\n * Select text to change justification...") (terpri) (setq t1 (ssget)) (setq num (load_dialog "justify.dcl")) (new_dialog "justify" num) (set_tile "L" "1") ; set left as default (action_tile "accept" "(do_getent)(done_dialog)") (start_dialog) ;(if (/=a nil) (do_change) ; end if ); end defun ; (defun do_getent () (if (= "1" (get_tile "L")) (setq j1 "L") ) (if (= "1" (get_tile "C")) (setq j1 "C") ) (if (= "1" (get_tile "R")) (setq j1 "R") ) (if (= "1" (get_tile "TL")) (setq j1 "TL") ) (if (= "1" (get_tile "TC")) (setq j1 "TC") ) (if (= "1" (get_tile "TR")) (setq j1 "TR") ) (if (= "1" (get_tile "ML")) (setq j1 "ML") ) (if (= "1" (get_tile "MC")) (setq j1 "MC") ) (if (= "1" (get_tile "BL")) (setq j1 "BL") ) (if (= "1" (get_tile "BC")) (setq j1 "BC") ) (if (= "1" (get_tile "BR")) (setq j1 "BR") ) ); end defun ; (defun do_change ( ) (setq m (sslength t1) index 0) (repeat m (setq a (entget (ssname t1 index)) p (cdr (assoc 0 a))) (if (= p "TEXT") (progn (setq j (assoc 72 a) j2 (assoc 73 a) p (assoc 10 a) q (assoc 11 a) j0 (cdr j) ); end setq (if (or (= j1 "L")(= j1 "C")(= j1 "R")(= j1 "M") (= j1 "BL")(= j1 "BC")(= j1 "BR") (= j1 "ML")(= j1 "MC")(= j1 "MR") (= j1 "TL")(= j1 "TC")(= j1 "TR") ); end or (if (= j0 0) (progn (setq p1 (cdr p) q1 (cons (car q) p1) n1 (subst q1 q a)) ); end progn (progn (setq q1 (cdr q) p1 (cons (car p) q1) n1 (subst p1 p a)) ); end progn ); end if );end if (cond ( (= j1 "L") (setq n (subst '(72 . 0) j n1)) (setq n (subst '(73 . 0) j2 n)) ) ( (= j1 "C") (setq n (subst '(72 . 1) j n1)) (setq n (subst '(73 . 0) j2 n)) ) ( (= j1 "R") (setq n (subst '(72 . 2) j n1)) (setq n (subst '(73 . 0) j2 n)) ) ( (= j1 "BL") (setq n (subst '(72 . 0) j n1)) (setq n (subst '(73 . 1) j2 n)) ) ( (= j1 "BC") (setq n (subst '(72 . 1) j n1)) (setq n (subst '(73 . 1) j2 n)) ) ( (= j1 "BR") (setq n (subst '(72 . 2) j n1)) (setq n (subst '(73 . 1) j2 n)) ) ( (= j1 "ML") (setq n (subst '(72 . 0) j n1)) (setq n (subst '(73 . 2) j2 n)) ) ( (= j1 "MC") (setq n (subst '(72 . 1) j n1)) (setq n (subst '(73 . 2) j2 n)) ) ( (= j1 "MR") (setq n (subst '(72 . 2) j n1)) (setq n (subst '(73 . 2) j2 n)) ) ( (= j1 "TL") (setq n (subst '(72 . 0) j n1)) (setq n (subst '(73 . 3) j2 n)) ) ( (= j1 "TC") (setq n (subst '(72 . 1) j n1)) (setq n (subst '(73 . 3) j2 n)) ) ( (= j1 "TR") (setq n (subst '(72 . 2) j n1)) (setq n (subst '(73 . 3) j2 n)) ) ); end cond (entmod n) ); end progn );end if (setq index (+ index 1)) ); end repeat (prin1) (princ " Changed ") ; Print total lines changed (princ index) (princ " text lines.") (terpri) (princ) ); end defun ;------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- //elise moss //Moss Designs //www.mossdesigns.com //12/30/98 // JUSTIFY.DCL // AutoLISP Dialog Box Program Menu justify : dialog { label = "JUSTIFY TEXT"; : boxed_radio_column { label = "Please Select Menu Item...."; width = 30; : radio_button { label = "LEFT"; key = "L"; } : radio_button { label = "CENTER"; key = "C"; } : radio_button { label = "RIGHT"; key = "R"; } : radio_button { label = "TOP LEFT"; key = "TL"; } : radio_button { label = "TOP CENTER"; key = "TC"; } : radio_button { label = "TOP RIGHT"; key = "TR"; } : radio_button { label = "MID RIGHT"; key = "MR"; } : radio_button { label = "MID LEFT"; key = "ML"; } : radio_button { label = "MID CENTER"; key = "MC"; } : radio_button { label = "BOTTOM LEFT"; key = "BL"; } : radio_button { label = "BOTTOM CENTER"; key = "BC"; } : radio_button { label = "BOTTOM RIGHT"; key = "BR"; } } spacer; ok_cancel; }