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:
Help to update a purge lisp
« previous
next »
Print
Pages: [
1
] |
Go Down
Author
Topic: Help to update a purge lisp (Read 1859 times)
0 Members and 1 Guest are viewing this topic.
mhy3sx
Newt
Posts: 120
Help to update a purge lisp
«
on:
December 20, 2023, 02:00:59 AM »
Hi. This code works fine in Autocad. I use ZWCAD now and some lisp codes don't work the same. I use this code to have a better purge. The problem is when I use this lisp in ZWCAD every time gives me this error (look the image), and all the time I have to press enter to continue. Can anyone know why?
The code is
Code - Auto/Visual Lisp:
[Select]
(
defun
c:myprg
(
/
Layer
-
p results
)
(
setvar
"clayer"
"0"
)
(
setvar
"cmdecho"
0
)
(
command
"._UNDO"
"BEGIN"
)
;; return boole for layer existence
(
defun
Layer
-
p
(
l
)
(
and
(
tblsearch
"LAYER"
l
)
)
)
(
setq
results
(
mapcar
'
(
lambda
(
x
)
(
Layer
-
p x
)
)
'
(
"layer1"
"layer2"
"layer3"
"layer4"
)
)
;end mapcar
)
(
foreach
x
(
list
"ZERO"
"EMPTY"
"BLOCK"
"MLINESTYLE"
"LAYER"
"LTYPE"
"VISUALSTYLES"
"MATERIALS"
)
(
if
(
member
't results
)
(
command
"-purge"
x
"*"
"n"
""
""
)
(
command
"-purge"
x
"*"
"n"
"-overkill"
"all"
""
""
)
)
;end if
)
; end foreach
(
command
"-purge"
"R"
""
"n"
)
(
command
"._UNDO"
"END"
)
(
setvar
"cmdecho"
1
)
(
princ
)
)
; end defun
Thanks
Logged
PKENEWELL
Bull Frog
Posts: 319
Re: Help to update a purge lisp
«
Reply #1 on:
December 20, 2023, 09:33:09 AM »
I suspect it is because there is no option in the ZWCAD purge command for "VISUALSTYLES" and "MATERIALS".
Change:
Code - Auto/Visual Lisp:
[Select]
(
foreach
x
(
list
"ZERO"
"EMPTY"
"BLOCK"
"MLINESTYLE"
"LAYER"
"LTYPE"
"VISUALSTYLES"
"MATERIALS"
)
to:
Code - Auto/Visual Lisp:
[Select]
(
foreach
x
(
list
"ZERO"
"EMPTY"
"BLOCK"
"MLINESTYLE"
"LAYER"
"LTYPE"
)
I would also check the command for any other missing or added options of the -PURGE command by manually going though it, then add or remove the appropriate strings from the above line.
Logged
"When you are asked if you can do a job, tell 'em, 'Certainly I can!' Then get busy and find out how to do it." - Theodore Roosevelt
mhy3sx
Newt
Posts: 120
Re: Help to update a purge lisp
«
Reply #2 on:
December 20, 2023, 10:32:00 AM »
Thanks PKENEWELL, now working fine
Logged
PKENEWELL
Bull Frog
Posts: 319
Re: Help to update a purge lisp
«
Reply #3 on:
December 20, 2023, 11:11:22 AM »
Quote from: mhy3sx on December 20, 2023, 10:32:00 AM
Thanks PKENEWELL, now working fine
Your most welcome
Logged
"When you are asked if you can do a job, tell 'em, 'Certainly I can!' Then get busy and find out how to do it." - Theodore Roosevelt
Print
Pages: [
1
] |
Go Up
« previous
next »
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
Help to update a purge lisp