Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; TEXTEDIT.LSP: routine to edit Text, Attributes, Attribute Definitions,
- ; or associative Dimensions with a single command.
- ; Written for R.12; remove all the underscores to use it with R.11.
- ; NOTE: will use DDIMEDIT.DCL, if present
- ;
- ; copyright 1993 by Mark Middlebrook, Daedalus Consulting
- ; prepared for AutoCAD Power Tools, 12 Sept 93
- ;------------------------------------------------------------------------
- (defun C:TEXTEDIT (/ olderr oteval en ed etype dcl_id)
- ;error handler
- (setq olderr *error*)
- (defun *error* (msg)
- (if (= msg "quit / exit abort")
- (princ)
- (princ (strcat "error: " msg))
- )
- (setq *error* olderr)
- (princ)
- )
- (initget "Last") ;allow Last obj. selection [requires R.12]
- (setq oteval (getvar "TEXTEVAL")
- en (entsel "\nSelect Text, Attribute, or Dimension text: ")
- );setq
- (setvar "TEXTEVAL" 1) ;required for DIM NEWTEXT
- (while en
- (if (= en "Last") (setq en (entlast)) (setq en (car en)))
- (setq ed (entget en)
- etype (cdr (assoc 0 ed))
- );setq
- (cond
- ((or (= etype "TEXT") (= etype "ATTDEF")) ;Text or Attribute Def.
- (command "._DDEDIT" en ""))
- ((= etype "INSERT") ;Block Insert
- (if (= 1 (cdr (assoc 66 ed))) ; are there Attributes?
- (command "._DDATTE" en) ; Yes.
- (prompt "\nBlock has no attributes.") ; No.
- )
- )
- ((= etype "DIMENSION") ;Associative Dimension
- (cond
- ((findfile "DDIMEDIT.DCL")
- (setq dimtxtold (cdr (assoc 1 ed)))
- (setq dcl_id (load_dialog "ddimedit.dcl"))
- (if (not (new_dialog "dim_edit" dcl_id)) (exit))
- (set_tile "dim_text" dimtxtold)
- (action_tile "dim_text" "(setq dimtxtnew $value)" )
- (action_tile "accept" "(done_dialog 1)" )
- (if (equal (start_dialog) 1)
- (entmod (list (cons -1 en) (cons 1 dimtxtnew)))
- )
- (unload_dialog dcl_id)
- );use dialogue
- (T (prompt "\nEnter new dimension text: ")
- (command "._DIM1" "_NEWTEXT" pause en "")
- );no dialogue
- );cond
- );dimension entity
- (T (prompt "\nEntity is not Text, Attribute, or Dimension text."))
- );cond
- (initget "Last")
- (setq en (entsel "\nSelect another <Return to quit>: "))
- );while
- (setvar "TEXTEVAL" oteval)
- (setq *error* olderr)
- (princ)
- );defun
- (defun C:TE () (C:TEXTEDIT))
- (prompt "\nTEXTEDIT.LSP loaded. TEXTEDIT or TE runs it.")
- (princ)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement