How to show a random selected entity’s AutoCad Handle

I am a little tired of looking for this so I thought I would copy it here. Here is the source.


(defun c:ShowHandle (/ en ed newtxt)
(if (setq en (entsel “Pick object: “)) ;Ask user to select object
(setq ed (entget (car en))) ;Get data of object

;; Create new text object’s data
(setq newtxt (list ‘(0 . “TEXT”)
(assoc 10 ed) ;Insert point on the same os the object’s 1st point
(cons 1 (cdr (assoc 5 ed)))
;Text value as per object’s handle
(cons 40 (getvar “TEXTSIZE”))
;Text height as per default
) ;_ end of list
) ;_ end of setq

“The object’s handle [”
(cdr (assoc 5 ed))
“] is now copied to a text object.\nUse last to select it.”
) ;_ end of strcat
) ;_ end of alert

) ;_ end of progn
(princ “Canceled”)
) ;_ end of if
) ;_ end of defun




Share Button

Leave a Reply

Your email address will not be published. Required fields are marked *

Please answer the question so the system knows your a human and not a web-bot * Time limit is exhausted. Please reload CAPTCHA.