AutoCAD LISP Creation

325 Views Asked by At

I want to create a LISP program to change the complete template with new template for batch of files. I created a script but it's showing an error:

(setq ss (ssget "_X" '((0 . "INSERT") ( 2 . "old_block_name"))))
(if ss (command "_.ERASE" ss ""))
_PURGE
_B
"old_block_name"
_N
_QSAVE
(command "_insert" "C:\\Users\\1011848\\Desktop\\new block.dwg" "0,0" "1" "1" "0")
_QSAVE

and

(defun c:make_script ( / prefix file_scr)
    (setq
        prefix (strcat (vl-filename-directory (getfiled "Select a file drawing for batch your directory" "" "dwg" 16)) "\\")
        file_scr (open (strcat prefix "batch_dir.scr") "w")
    )
    (foreach dwg (vl-directory-files prefix "*.dwg" 1)
        (write-line "_.open" file_scr)
        (write-line (strcat "\"" prefix dwg "\"") file_scr)
;;Begin of your commands
        (write-line "(load \"br.lsp\")" file_scr)
;;End of your commands
        (write-line "_.qsave" file_scr)
        (write-line "_.close" file_scr)
    )
    (close file_scr)
    (princ (strcat "\nYou can use the SCRIPT :" prefix "hope.scr"))

(prin1)
)
0

There are 0 best solutions below