TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: jlogan02 on July 08, 2022, 12:51:44 PM
-
According to the description in the lisp file...
This doesn't seem to be working. What am I missing?
The text is found and a selection set is created.
(if (setq ss
(ssget "x" '
((0 .
"mtext") (62 .
1)))) (StripMtext ss '
("C")))
At the command line..
Tried this variation
Selection set made
but returns a selection set again once command issued.
At the command line...
Command: (setq ss (ssget "x" '((0 . "mtext") (62 . 1))))
<Selection set: 15d>
Command: (Command "-SMT" ss "C" "")
-SMT Unknown command "-SMT". Press F1 for help.
Command: <Selection set: 349>
All works fine with SMT outside of lisp and at the command line with
Command: SMT ...dialog box
-
Need to read a bit further down the description.
(StripMtext (ssget "x") "c")
works.
Edit: now to isolate for just color red.
-
Ok...not having any luck here.
We use color (red) as a revision identifier.
We use color (15) as a future identifier.
I've been using this...
(if (setq sel
(ssget "_X" '
((0 .
"mtext") (62 .
1))));;MTEXT )
)
)
because some of our users have a tendency to use the Mtext dialog to set the color. I don't like this approach because it leaves the {Ccolor # and doesn't actually strip it away, it just changes the color to \\C256. So future uses of other routines are rendered obsolete, or I'd have to write more routines to cover all the possibilities.
StripMtext is the answer, but I'm not able to isolate just one color using logic..
(StripMtext
(ssget "x" '
((-4 .
"<>")(62 .
15))) "c")
but that only selects color properties and not Mtext dialog hard coded color. Am I relegated to asking the user to select the offending Mtext entities? I prefer the hunt and kill method without users selecting things.
-
Ok...I just added this to the end of the routine.
(Alert "Some MText may have not be returned to their bylayer color. Please select them now") (StripMtext
(ssget) "c") ;;select all red text not changed by routine.
Not optimal, but at least with the alert, some training, and the user hopefully using their eyes they'll get it done.
I can live with this.