- ;;; CHTEXT.lsp - change text
- ;;;
- ;;; Copyright 1997 by Autodesk, Inc.
- ;;;
- ;;; Permission to use, copy, modify, and distribute this software
- ;;; for any purpose and without fee is hereby granted, provided
- ;;; that the above copyright notice appears in all copies and
- ;;; that both that copyright notice and the limited warranty and
- ;;; restricted rights notice below appear in all supporting
- ;;; documentation.
- ;;;
- ;;; AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
- ;;; AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
- ;;; MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
- ;;; DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
- ;;; UNINTERRUPTED OR ERROR FREE.
- ;;;
- ;;; Use, duplication, or disclosure by the U.S. Government is subject to
- ;;; restrictions set forth in FAR 52.227-19 (Commercial Computer
- ;;; Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
- ;;; (Rights in Technical Data and Computer Software), as applicable.
- ;;;
- ;;;--------------------------------------------------------------------------;
- ;;; DESCRIPTION
- ;;; This is a "text processor" which operates in a global manner
- ;;; on all of the text entities that the user selects; i.e., the
- ;;; Height, Justification, Location, Rotation, Style, Text, and
- ;;; Width can all be changed globally or individually, and the
- ;;; range of values for a given parameter can be listed.
- ;;;
- ;;; The command is called with CHT from the command line at which
- ;;; time the user is asked to select the objects to change.
- ;;;
- ;;; Select text to change.
- ;;; Select objects:
- ;;;
- ;;; If nothing is selected the message "ERROR: Nothing selected."
- ;;; is displayed and the command is terminated. If more than 25
- ;;; entities are selected the following message is displayed while
- ;;; the text entities are sorted out from the non-text entities.
- ;;; A count of the text entities found is then displayed.
- ;;;
- ;;; Verifying the selected entities...
- ;;; nnn text entities found.
- ;;; CHText: Height/Justification/Location/Rotation/Style/Text/Undo/Width:
- ;;;
- ;;; A typical example of the prompts you may encounter follows:
- ;;;
- ;;; If you select a single text entity to change and ask to change
- ;;; the height, the prompt looks like this:
- ;;;
- ;;; CHText: Height/Justification/Location/Rotation/Style/Text/Undo/Width:
- ;;; New text height for text entity. <0.08750000>:
- ;;;
- ;;; If you select more than one text entity to change and ask to change
- ;;; the height, the prompt looks like this:
- ;;;
- ;;; CHText: Height/Justification/Location/Rotation/Style/Text/Undo/Width:
- ;;; Individual/List/<New height for all entities>:
- ;;;
- ;;; Typing "L" at this prompt returns a prompt showing you the range of
- ;;; values that you are using for your text.
- ;;;
- ;;; Height -- Min: 0.05000000 Max: 0.10000000 Ave: 0.08392857
- ;;;
- ;;; Typing "I" at this prompt puts you in a loop, processing the text
- ;;; entities you have selected one at a time, and giving the same prompt
- ;;; you get for a single text entity shown above.
- ;;;
- ;;; Pressing ENTER at this point puts you back at the Command: prompt.
- ;;; Selecting any of the other options allows you to change the text
- ;;; entities selected.
- ;;;
- ;;;---------------------------------------------------------------------------;
- (defun cht_Main ( / sset opt ssl nsset temp unctr ct_ver sslen style hgt rot
- txt ent loc loc1 just-idx justp justq orthom
- cht_ErrorHandler cht_OrgError cht_OrgCmdecho
- cht_OrgTexteval cht_OrgHighlight)
- ;; Reset if changed
- (setq ct_ver "2.00")
- ;; Internal error handler defined locally
- (defun cht_ErrorHandler (s)
- (if (/= s "Function cancelled")
- (if (= s "quit / exit abort")
- (princ)
- (princ (strcat "\nError: " s))
- )
- )
- (eval (read U:E))
- ;; Reset original error handler if there
- (if cht_OrgError (setq *error* cht_OrgError))
- (if temp (redraw temp 1))
- (ai_undo_off) ;; restore undo state
- (if cht_OrgCmdecho (setvar "cmdecho" cht_OrgCmdecho))
- (if cht_OrgTexteval (setvar "texteval" cht_OrgTexteval))
- (if cht_OrgHighlight (setvar "highlight" cht_OrgHighlight))
- (princ)
- )
- ;; Set error handler
- (if *error*
- (setq cht_OrgError *error*
- *error* cht_ErrorHandler)
- (setq *error* cht_ErrorHandler)
- )
- ;; Set undo groups and ends with (eval(read U:G)) or (eval(read U:E))
- (setq U:G "(command "_.undo" "_group")"
- U:E "(command "_.undo" "_en")"
- )
-
- (ai_undo_on) ;; enable undo
-
- (setq cht_OrgCmdecho (getvar "cmdecho"))
|