• Home /
  • alt /
  • cad /
  • autocad /
  • How to invoke autolisp routine and script file to one common ...

Delete / Löschen

How to invoke autolisp routine and script file to one common autolisp file.

maqlukas
25.11.2009 - 17:18
Hi all,
Does anybody know how to build one autolisp routine which invokes both
script command and load a lot of other autolisp subroutines in such
way that then with one command I can run e.g. batch plot through many
drawings without repeat (load "routine1") (routine1) (load "routine2")
(routine2) and many subsidiary lisp files. S5 far it does work but
seems to be for me too clumsy.
Here comes my present and working system:

(defun C:PLOTIT ()
...
(command "-plot" "Yes" (getvar "CTAB") "DWG To PDF.pc3" "ISO A1
(594.00 x 841.00 MM)" "M" "L" "Y" "E" "1:1" "Center" "Y"
"monochrome.ctb" "Y" "N" "N" "N" plotname "Y" "Y")
...
)


(defun C:MAKEPLOT ( )
;;; creates scriptfile
(open "scriptfile" "w")
(write-line "(load \"C:\\\\PLOTIT.lsp\")" "scriptfile")
(write-line "PLOTIT" "scriptfile")
...
...
(close "scriptfile")

;;; runs scriptfile
(command "script" "scriptfile")

)

When I load and run MAKEPLOT it works perfectly!

Now, what I want to avoid is repeating (write-line "(load \"C:\\\
\PLOTIT.lsp\")" "scriptfile") in my scriptfile and move the PLOTIT
subroutine into the host file MAKEPLOT, like this:
(defun C:MAKEPLOT ( )

(defun PLOTIT ()
...
(command "-plot" "Yes" (getvar "CTAB") "DW
To PDF.pc3" "ISO A1
(594.00 x 841.00 MM)" "M" "L" "Y" "E" "1:1" "Center" "Y"
"monochrome.ctb" "Y" "N" "N" "N" plotname "Y" "Y")
...
)

;;; creates scriptfile
(open "scriptfile" "w")
;;; (write-line "(load \"C:\\\\PLOTIT.lsp\")" "scriptfile")
(write-line "PLOTIT" "scriptfile")
...
...
(close "scriptfile")

;;; runs scriptfile
(command "script" "scriptfile")

)
It works but only on the first drawing and after this stops with the
meassge 'PLOTIT' unkown command.

Any idea how to workaround the problem?

Regards
Maq




Share/Bookmark