Hello
I wish to insert a stored variable (which happens to be text) into an attributed block, the attribute tag is 'height'.
I also wish to add a prefix of 'H: ' to the stored variable.
I can do the second bit by:
(SETQ HT1 (STRCAT "H: " HT))
this is the lisp I have at the moment.
The block has 7 attributes and the height attribute is the 6th.
A quick hand with this would be appreciated.
I need to change this part:
(COMMAND "text" PTXT THGT "<<0" HT2)
(command "move" "last" "" PTXT pause)
so that 'HT2' is inserted into the attributed block
;;
;;
(defun C:TH()
;;
(setq ent1 (car (entsel "\nPick the Tree Level:"))); single pick
(setq ent4 (car (entsel "\nPick the Height Level:"))); single pick
(if ent1
(progn
(setq elist1 (entget ent1)); get a List of that entity
(setq atr1 (entnext ent1)); get 1st attribute entity
(setq en1 (entget atr1)); get a List of attribute entity
(setq val1 (cdr (assoc 1 en1))); get the attrib's value
(setq num1 (atof val1)); make a number of val
(if ent4
(progn
(setq elist4 (entget ent4)); get a List of that entity
(setq atr4 (entnext ent4)); get 1st attribute entity
(setq en4 (entget atr4)); get a List of attribute entity
(setq val4 (cdr (assoc 1 en4))); get the attrib's value
(setq num4 (atof val4)); make a number of val
(prompt (strcat "\nTREE LEVEL=" val1)); display on Command Line
(prompt (strcat "\nHEIGHT LEVEL=" val4)); display on Command Line
(SETVAR "cmdecho" 0)
(COMMAND "units" "" 2 "" "" "" "")
(setq HT (rtos (- num4 num1)))
(COMMAND "units" "" 3 "" "" "" "")
(SETVAR "cmdecho" 1)
(prompt (strcat "\nTREE HEIGHT=" HT)); display on Command Line
); progn
); if
(SETQ DFLT 0)
(SETQ TXTHG (GETVAR "textsize"))
(PRINC "\nText Height: <")
(PRIN1 TXTHG)
(PRINC ">: ")
(SETQ THGT (GETDIST))
(IF (= THGT nil)
(SETQ THGT TXTHG)
)
;(SETQ ANNOT (GETSTRING "\nAnnotation: "))
(SETQ HT1 (STRCAT "H: " HT))
(SETQ HT2 (STRCASE HT1))
;;(SETQ PTXT (GETPOINT "\nLocate Text: "))
(setq old_layer (getvar "clayer")); Get current Layer
(SETVAR "cmdecho" 0)
(setq PTXT (getvar "viewctr"))
(COMMAND "layer" "se" "tree text" "")
;(COMMAND "text" PTXT THGT "<<0" HT2)
;(command "move" "last" "" PTXT pause)
(setq CLASHING "CLASHING_LEVELS")
(if (not (tblsearch "layer" CLASHING))
(command "_layer" "M" CLASHING ""); Make the Layer, and set it current
); if
(command "_change" ent4 "" "_P" "_LA" CLASHING "")
(command "_layer" "S" old_layer ""); reset Layer
(SETVAR "cmdecho" 1)
(princ)
))); function LEV2HT
cheers
P