(vl-load-com)
(defun c:CS( / s str ob)
(if (setq s (car (entsel)))
(cond
((wcmatch (setq str (strcase (vlax-get (setq ob (vlax-ename->vla-object s)) ‘textstring))) “*D10*”)
(vlax-put ob ‘color 80)
)
((wcmatch str “*D13*”)
(vlax-put ob ‘color 130)
)
((wcmatch str “*D16*”)
(vlax-put ob ‘color 170)
)
((wcmatch str “*D19*”)
(vlax-put ob ‘color 190)
((wcmatch str “*D19*”)
(vlax-put ob ‘color 190)
)
((wcmatch str “*D21*”)
(vlax-put ob ‘color 210)
)
)
)
(princ)
)
((wcmatch str “*D21*”)
(vlax-put ob ‘color 210)
)
)
)
(princ)
)
이렇게 되어있는데 이거는 각각 선택을 따로해야되는데 다중선택해서 적용해주려면 어떻게 해야할까요?
(defun c:CS( / str)
(if (ssget ‘((0 . “*TEXT”)))
(vlax-for ob (vla-get-ActiveSelectionSet (vla-get-ActiveDocument (vlax-get-acad-object)))
(cond
((wcmatch (setq str (strcase (vlax-get ob ‘textstring))) “*D10*”)
(vlax-put ob ‘color 80)
)
((wcmatch str “*D13*”)
(vlax-put ob ‘color 130)
)
((wcmatch str “*D16*”)
(vlax-put ob ‘color 170)
)
((wcmatch str “*D19*”)
(vlax-put ob ‘color 190)
)
((wcmatch str “*D21*”)
(vlax-put ob ‘color 210)
)
)
)
)
(princ)
)