Good day everyone.
Here's a code that when I select a circle it will select all the circles that is the same diameter as the first selected. Next thing I need is for all that selected circle to be added with a center mark and a text. The problem is it only adds center mark to one of the selected circles and the text is not showing. What could be the problem with my code? Thanks in advance
(defun c:STX (/ first_circle ss first_diameter text)
(setq first_circle (car (entsel "\\nSelect the first circle: ")))
(if (and first_circle (eq (cdr (assoc 0 (entget first_circle))) "CIRCLE"))
(progn
(setq first_diameter (cdr (assoc 40 (entget first_circle))))
(setq ss (ssget "_C" (list (cons 0 "CIRCLE") (cons 40 first_diameter))))
(if ss
(progn
(sssetfirst nil ss)
(setq text (getstring "\\nEnter the text to insert: "))
(if (not (null text))
(progn
(command "_TEXTSTYLE" "_PICK" "_Default")
(foreach ent (ssnamex ss)
(command "_.DIMCENTER" ent) ; Add center mark
(command "_.TEXT" ent "_M" "CENTER" (cdr (assoc 10 (entget first_circle))) text) ; Insert text
)
(princ "\\nText and center marks added to selected circles.")
)
(princ "\\nText input is empty.")
)
)
(princ "\\nNo matching circles found.")
)
)
(princ "\\nPlease select a valid circle.")
)
(princ)
)
