Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Home
Help
Login
Register
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
For the life of me.
« previous
next »
Print
Pages: [
1
] |
Go Down
Author
Topic: For the life of me. (Read 987 times)
0 Members and 1 Guest are viewing this topic.
jlogan02
Bull Frog
Posts: 327
For the life of me.
«
on:
November 16, 2020, 05:57:11 PM »
This routine does mostly what I want. I need to select all Mtext with color overridden to red "without user input".
For whatever reason, this baffles!!!
Code - Auto/Visual Lisp:
[Select]
(
defun
c:MTColor
(
/
e o txt
)
(
if
(
and
(
setq
e
(
car
(
entsel
"
\n
Pick mtext: "
)
)
)
(
=
"MTEXT"
(
cdr
(
assoc
0
(
entget
e
)
)
)
)
(
setq
o
(
vlax
-
ename
->
vla-object
e
)
)
)
(
progn
(
setq
txt
(
vla-get-textstring
o
)
)
(
while
(
vl-string-search
"
\\
C1;"
txt
)
(
setq
txt
(
vl
-
string
-
subst
"
\\
C256;"
"
\\
C1;"
txt
)
)
)
(
vla-put-textstring
o txt
)
)
)
(
princ
)
)
Logged
J. Logan
ACAD 2018
I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10
jlogan02
Bull Frog
Posts: 327
Re: For the life of me.
«
Reply #1 on:
November 16, 2020, 06:05:04 PM »
Never mind...
this seems to work.
Code - Auto/Visual Lisp:
[Select]
(
defun
c:nameit
(
/
int o txt
)
(
if
(
setq
sel
(
ssget
"_X"
'
(
(
0
.
"MTEXT"
)
)
)
)
;;Mtext
(
repeat
(
setq
int
(
sslength
sel
)
)
(
setq
obj
(
vlax
-
ename
->
vla-object
(
ssname
sel
(
setq
int
(
1-
int
)
)
)
)
)
(
progn
(
setq
txt
(
vla-get-textstring
obj
)
)
(
while
(
vl-string-search
"
\\
C1;"
txt
)
(
setq
txt
(
vl
-
string
-
subst
"
\\
C256;"
"
\\
C1;"
txt
)
)
)
(
vla-put-textstring
obj txt
)
)
)
)
(
princ
)
)
Logged
J. Logan
ACAD 2018
I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10
Print
Pages: [
1
] |
Go Up
« previous
next »
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
For the life of me.