HiHo; Here is a R14 lisp program and DCL. Hope this helps. ............................................................................ ................ SAVE BELOW as jrRoText.lsp ............................................................................ ................. ;;;jrRoText ;;; A general text rotater ;;; Rotates text about the midpoint ;;; of selected text. ;;;========================================================
(defun *error* (msg) (Alert msg) (princ) );end defun error
;========================================================== ; Set and Save System Variables ; REMBEMBER to edit the vlist list ;========================================================== (Defun pushvars ( ) (setq vlist '(("cmdecho" . 0) ("osmode" . 0) ("OSNAPCOORD" . 1) ("PICKFIRST" . 1) ("AUNITS" . 0) ("ANGBASE" . 0) ("ANGDIR" . 0) ) );end setq
(ForEach pair vlist (Setq name (Strcase (CAR pair) T)) (If (Not (Assoc name sysvars)) (Setq sysvars (Cons (Cons name (GetVar name)) sysvars) ) ) (If (CDR pair) (Setvar name (CDR pair)) ) );end foreach );end pushvars
;========================================================== ; Restore System Variables ;========================================================== (Defun popvars ( ) (ForEach pair sysvars (Setvar (CAR pair) (CDR pair)) ) (Setq *error* old_error) (Setq sysvars Nil) );end popvars
;========================================================= ;;;Start Subs ;==========================================================
(defun jrotext ( ) (setq DCL_ID (load_dialog "jrRoText.dcl")) (if (not (new_dialog "jrRoText" DCL_ID)) (exit)) (action_tile "AngEnt" "(setq ang_in (atof $value))") (start_dialog) (unload_dialog DCL_ID)
(setq hr (fix ang_in) mm (fix (* 100 (- ang_in hr))) ss (fix (- (* 10000 ang_in) (+ (* 10000 hr) (* 100 mm)))) ang_out (+ hr (/ mm 60.0) (/ ss 3600.0)) );setq
(PRINC "\nSELECT TEXT TO ROTATE") (SETQ SS1 (SSGET '((0 . "TEXT"))) len 0 );end setq (WHILE (> (sslength ss1)len) (setq enam (SSNAME SS1 len)) (get_middle) (command "ROTATE" enam "" middle ang_out) (setq len (1+ len)) );end while
);end jrotext ;========================================================== ; Middle point of text entity ;==========================================================
(Defun get_middle () (Command ".ucs" "e" enam) (Setq middle (Trans (Apply 'xer_midpoint (TextBox (EntGet enam)) ) 1 0 ) ) (Command ".ucs" "p") (Setq middle (Trans middle 0 1)) );end get_middle
;=========================================================== ; Midpoint between p1 and p2 ;========================================================== (Defun xer_midpoint (p1 p2) (MapCar '(Lambda (x1 x2) (* 0.5 (+ x1 x2))) p1 p2 ) );end xer_midpoint
;========================================================== ;;;End Subs ;========================================================== ;;;Start of main program ;========================================================== (defun c:grt (/ SumVars Stuff) (setq old_error *error*) (pushvars) ;;; The rest of the program goes here (jrotext)
;========================================================== (popvars) (princ) );end c:grt (prompt "\Enter grt to run") ............................................................................ . ............................................................................ SAVE BELOW as jrRoText.dcl ............................................................................ // jrRoText DCL // Use for comments // use ; for end of field
jrRoText : dialog { // begin dialog definition label = "Rotate Text";
:edit_box { label = "Enter Rotatation Angle DD.MMSS"; key = "AngEnt"; edit_width = 10; value = "0"; }
errtile; ok_cancel;
}