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=E5 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
|
|
|
|
Reply
|
maqlukas (1)
|
11/25/2009 4:17:14 PM |
|
On Nov 25, 5:17=A0pm, maqlukas <maqlu...@gmail.com> wrote:
> 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=E5 far it does work but
> seems to be for me too clumsy.
> Here comes my present and working system:
>
> (defun C:PLOTIT ()
> =A0 =A0...
> =A0 =A0(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")
> =A0 =A0...
> )
>
> (defun C:MAKEPLOT ( )
> =A0 =A0 ;;; creates scriptfile
> =A0 =A0 (open "scriptfile" "w")
> =A0 =A0 (write-line "(load \"C:\\\\PLOTIT.lsp\")" =A0"scriptfile")
> =A0 =A0 (write-line "PLOTIT" "scriptfile")
> =A0 =A0 ...
> =A0 =A0 ...
> =A0 =A0 (close "scriptfile")
>
> =A0 =A0 ;;; runs scriptfile
> =A0 =A0 (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\")" =A0"scriptfile") in my scriptfile and move the PLOTIT
> subroutine into the host file MAKEPLOT, like this:
> (defun C:MAKEPLOT ( )
>
> =A0 =A0(defun PLOTIT ()
> =A0 =A0 =A0 ...
> =A0 =A0 =A0 (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")
> =A0 =A0 =A0 ...
> =A0 =A0)
>
> =A0 =A0 ;;; creates scriptfile
> =A0 =A0 (open "scriptfile" "w")
> =A0 =A0 ;;; =A0 =A0 =A0 (write-line "(load \"C:\\\\PLOTIT.lsp\")" =A0"scr=
iptfile")
> =A0 =A0 (write-line "PLOTIT" "scriptfile")
> =A0 =A0 ...
> =A0 =A0 ...
> =A0 =A0 (close "scriptfile")
>
> =A0 =A0 ;;; runs scriptfile
> =A0 =A0 (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
Just a suggestion, look at the AutoLisp "Repeat" function, or have you
thought of making it to an recursive function.
Rough way to do it, but there are a trigger to the repeat function as
far I remember.
|
|
0
|
|
|
|
Reply
|
per
|
11/27/2009 12:05:44 PM
|
|