lisp routine to align text to a line

 Hi
I'm no lisp programmer.
I used the following lisp routine with a previous employer. Its a great little time saver allowing you to align text to any object line polyline etc just by snaps.

(PROMPT "\nLOADING FILE .........")
;
;  CHANGE THE ROTATION OF SELECTED TEXT

(defun C:TT ( / selset newscl l n e as)
  (setq olderr *error* *error* err)

  (setq selset (ssget))

  (command "undo" "begin")   
   (GETSYS)
;;LCA - COMMENT: The UCS command has new options.
   (COMMAND "UCS" "W")
   
   (setq 
      newrot (getorient "\nNew Orientation, Pick 2 points (Return to leave same): ")
      newscl (getreal   "\nNew Height   (Return to leave same): ")
   )
   (if selset
      (progn
         (setq l 0 n (sslength selset))
         (while (< l n)
            (if (wcmatch (cdr (assoc 0 (setq e (entget (ssname selset l))))) "*TEXT")
               (progn
                  (prompt ".")
                  (if newscl
                     (progn
                        (setq s (cdr (setq as (assoc 40 e))))
                        (setq e (subst (cons 40 newscl) as e))
                        (entmod e)
                     )
                  )
                  (if newrot  
                     (progn
                        (setq s (cdr (setq as (assoc 50 e)))
                           ;             cur (getvar "UCSNAME")
                           ;             n (cdr (assoc 12 (tblsearch "UCS" cur)))
                           ;             m (cdr (assoc 10 (tblsearch "UCS" cur)))
                           ;             ax (- (cadr n) (cadr m) ) bx (- (car n) (car m) )
                           ;             alpha (atan ax bx)
                        )
                        (setq e (subst (cons 50 newrot) as e))
                        (entmod e)
                     )
                  )  
               )
            )  
            (setq l (1+ l))
         )
      )
   )
;;LCA - COMMENT: The UCS command has new options.
   (command "ucs" "p")
   (command "osnap" "none")
   (command "move" "P" "" pause pause)
   (resetsys)
   (command "undo" "end")
   (princ)
)
I've tried loading it into Bricscad 2016 and running the command but get the following error message in command line

: tt
Select entities: 
Entities in set: 1
Select entities: 
: undo
Undo:  Mark/Back to mark/BEgin set/End set/Control/Auto/: begin
; ----- LISP : Call Stack -----
; [0]...C:TT <<--</b>
;
; ----- Error around expression -----
(GETSYS)
;
"no function definition ; expected FUNCTION at [eval]" 

I'd love to get this one working. If anyone knows the solution or alternatively has a Brics lisp that does the same I'd love to hear from you.

Thanks in advance

Comments