Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

3 views
Skip to first unread message

maqlukas

unread,
Nov 25, 2009, 11:18:44 AM11/25/09
to
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. Så 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") "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")
...
)

;;; 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

0 new messages