Hi there,
Just wondering if anyone has script/routine to select and delete dtext from multiple drawings.
We're trying to remove particular instances of text originally placed into a drawings (about 2000 in total so far), the text is 4 characters in all cases but shares a layer with other text within the drawing which is making automating the selection a little tricky.
TIA,
B
what bout filtering by string value with an and condition?
Same textstyle? Textheight? color by layer? by entity?
Model and/or paper space?
Are these exclusively TEXT or some are MTEXT?
Part of an attribute?
Pardon for all the questions. it matters with filtering <string or otherwise>
Hi there,
It's not that easy to isolate the text strings, they are all dtext but share properties, style, layer etc with other dtext which we wish to retain, we were hoping for something that would use either wild cards (M1*) or a specifc number of characters to select the text entities.
B
thats exactly why we're going to use and function my friend,
sample:
(defun c:cmb () (mapcar '(lambda (j) (if (eq (cdr (assoc 1 (entget j))) "BANANA") (vla-put-color (vlax-ename->vla-object j) acBlue)) ) (vl-remove-if 'listp (mapcar 'cadr (ssnamex (ssget '((0 . "TEXT"))))))) (princ) )
This code will select all text with a string value of "BANANA" and if by chance theres aother text with the same string but another layer, then:
(defun c:cmb () (mapcar '(lambda (j) (if (and (eq (cdr (assoc 1 (entget j))) "BANANA") (eq (cdr (assoc 8 (entget j))) "TEXT")) (vla-put-color (vlax-ename->vla-object j) acBlue)) ) (vl-remove-if 'listp (mapcar 'cadr (ssnamex (ssget '((0 . "TEXT"))))))) (princ) )
and so on ...
Running it thru script is fairly easy, tell me exactly what you need and we'll try and figure it out together
Although this would do same
(ssget '((0 . "TEXT")(1 . "BANANA")(8 . "TEXT")))
We are preparing for a routine that will execute exclusion depending on other factors
@bodhran wrote:[earlier] ... the text is 4 characters in all cases ....
[later] ... they are all dtext but share properties, style, layer etc with other dtext which we wish to retain, we were hoping for something that would use either wild cards (M1*) or a specifc number of characters to select the text entities.
....
This will find all Text [or Mtext] entities of four characters beginning with M1 [see the wild-card options under (wcmatch) in the AutoLISP Reference]:
(ssget "X" '((1 . "M1??")))
If you think there might be other kinds of things than Text or Mtext that might have that kind of value in a 1-code entry, or if there might be Mtext entities that say the same thing that you would not want it to find, then add the Text filter [by the way, there's no such entity type as "dtext"]:
(ssget "X" '((0 . "TEXT") (1 . "M1??")))
@Kent1Cooper wrote:(ssget "X" '((0 . "TEXT") (1 . "M1??")))
Oh boy... never thought it would be that easy
I was thinking of something else entirely
simple like that Kent