@msarqui wrote:
Sorry for the dumb question but:
(Defun _colorsofthewind (str_ l / p d f)
str_ = text string
l = ? Entity name?
Sorry as well msarqui, I did not explain the usage, l is a type LIST.
What i intended to do with the code is count ALL the colors that are used on selected MTEXT's , so
_$ (setq colordata (_colorsofthewind str colordata))
(6 67 9 175)
colordata as the collected colors after processing the selection sets.
Passing a nil value would also work if the user is intending to count colors per selected MTEXT.
_$ (setq colordata (_colorsofthewind str nil))
(6 67 9 175)
Anyway, here's the iterative version
(Defun _colorsofthewind (str_ / l p d f)
(while
(and
str_
(setq p (vl-string-search "\\C" str_))
(setq str_ (substr str_ (+ 2 p)))
(setq d (vl-some (function (lambda (s)
(if (wcmatch str_ (strcat "C" s ";*")) s)))
'("#" "##" "###")))
)
(if (member (setq f (atoi (substr str_ 2 (strlen d)))) l)
l (setq l (cons f l))
)
l
)
)
$
(setq colordata (_colorsofthewind str))
$
(6 67 9 175)
$
HTH