Hi
I am trying to edit a lisp so that some annotation can either be added by text input or by clicking on the text in the drawing.
I have found Lee's function
https://www.theswamp.org/index.php?topic=39042.0LM:SelectionOrText
but am having difficulty integrating it as I am a bit of a lisp U grader.
The function returns the entity name, whereas I want the text contents (cdr (assoc 1 ent)) ??
All I need is the text if manually entered or the selected text entities contents saved to a variable, bit I'm damned if I can do it..
Here is the lisp, any help would be appreciated.
P
;;
;; Routine to convert level block attributes to text levels with annotation
;;
;;
;;
;;
(PRINC "\nText Height: <") )
(setq elist7
(entget ent7
)); get a List of that entity (setq en7
(entget atr7
)); get a List of attribute entity (setq num7
(atof val7
)); make a number of val
;(SETVAR "cmdecho" 0)
;(COMMAND "units" "" 2 "" "" "" "")
;(COMMAND "units" "" 3 "" "" "" "")
;(SETVAR "cmdecho" 1)
; (prompt (strcat "\nLEVEL=" LEV)); display on Command Line
); progn
); if
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;(SETQ ANNOT (GETSTRING "\nAnnotation: "))
(setq annottxt
(LM:SelectionOrText
"\nSelect text: " '
((0 .
"TEXT")))) ;;;; if text is manually inputed selected then everything is fine and I can save it to annot, but it text selected it returns the entity name. ;(setq annot (cdr (assoc 1 ent)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;(SETQ PTXT (GETPOINT "\nLocate Text: "))
(setq old_layer
(getvar "clayer")); Get current Layer
(COMMAND "text" PTXT THGT
"<<0" LEV2
) (command "move" "last" "" PTXT pause
)
(setq CLASHING
"CLASHING_LEVELS")
(command "_layer" "M" CLASHING
""); Make the Layer, and set it current ); if
(command "_change" ent7
"" "_P" "_LA" CLASHING
"")
(command "_layer" "S" old_layer
""); reset Layer
); function LEV2LEV
;;;;https://www.theswamp.org/index.php?topic=39042.0
(defun LM:SelectionOrText
( msg filter
/ g1 g2 gr res ss
) (princ msg
) (setq res
"") )
( (= 3 g1)
)
)
)
( (= 2 g1)
( (<= 32 g2 126)
)
( (= 13 g2)
nil
)
(princ (vl
-list
->string '
(8 32 8))) )
( t )
)
)
( (= 25 g1)
nil
)
( t )
)
)
)
res
)