- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I got this code from ChatGPT. Its a routine that sends all the wipeouts in all blocks to the back.
I am getting an error however when I try to upload it using appload (error: syntax error)
Can anyone see what's wrong with it please, thanks.
(I know its from an AI so it might not be all correct but I tested it with another lisp I asked it to create and that one works)
(defun c:WipeoutBlocksToBack (/ blkname blk ss enx ent i j)
(setq blkname (getvar "blkname"))
(foreach blk (mapcar 'cdr (tblnext "block" T))
(if (not (tblsearch "block" blk))
(setq blk (strcase blk))
(progn
(setq blk (strcase blk))
(if (not (equal blk blkname))
(progn
(command "_-insert" blk "0,0" "1" "1" "0")
(setq ss (ssget "_X" '((0 . "WIPEOUT"))))
(if ss
(repeat (setq i (sslength ss))
(setq i (1- i) ent (ssname ss i) enx (entget ent))
(setq enx (subst (cons 62 0) (assoc 62 enx) enx))
(entmod enx)
)
)
(command "_undo" "_end")
)
)
)
)
)
(setq ss (ssget "_X" '((0 . "WIPEOUT"))))
(if ss
(repeat (setq i (sslength ss))
(setq i (1- i) ent (ssname ss i) enx (entget ent))
(if (cdr (assoc 330 ent))
(progn
(command "_undo" "_end")
(setq blkname (cdr (assoc 330 ent)))
(command "_-insert" blkname "0,0" "1" "1" "0")
(setq ss (ssget "_X" '((0 . "WIPEOUT"))))
(if ss
(repeat (setq j (sslength ss))
(setq j (1- j) ent (ssname ss j) enx (entget ent))
(setq enx (subst (cons 62 0) (assoc 62 enx) enx))
(entmod enx)
)
)
(command "_undo" "_end")
)
(setq enx (subst (cons 62 0) (assoc 62 enx) enx))
(entmod enx)
)
)
(princ "\nNo wipeouts found.")
)
(princ)
)
Solved! Go to Solution.