Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
interface.typepad.com/through_the_interface/)
A blog for developers programming with AutoCAD and other Autodesk platforms.
This modified approach was suggested by a member of our Engineering team in a recent thread (one that I came across
after Monday’s post). It uses a data file to store a list of the drawings to process and only creates a script to load – and
launch processing on – the next drawing in that list:
(defun C:BATCH(/ dwgs lsp-name data-name)
(setq dwgs '("C:/A.DWG" "C:/B.DWG" "C:/C.DWG" "C:/D.DWG")
lsp-name "c:/tmp.lsp"
data-name "c:/dwgs.tmp"
)
(create-drawing-list data-name dwgs)
(process-next-drawing data-name lsp-name "(create-circle)" T T)
(princ)
)
(defun create-circle()
(command "_.CIRCLE" "10,10,0" "5")
)
1
;; Reverse the list, take the head and write
;; back the remainder to the file
(if dwg
(progn
(create-script scr data dwg lsp save first)
(command "_.SCRIPT" scr)
)
(progn
(vl-file-delete data)
(vl-file-delete scr)
(command "_.CLOSE")
)
)
)
2
(strcat "_.OPEN \"" dwg "\"") f
)
(write-line
(strcat "(load \"" lsp "\")") f
)
(write-line
(strcat
"(process-next-drawing \""
data "\" \"" lsp "\" \"" func "\" "
(if save "T" "nil") " nil)"
)
f
)
(close f)
(princ)
)
I hope this is useful to people – as mentioned before, please do provide feedback on how/whether this works for you…
(http://twitter.com/share?url=http%3A%2F%2Fthrough-the-interface.typepad.com%2Fthrough_the_interface%
2F2009%2F06%2Fbatch-processing-autocad-drawings-from-lisp-without-sdi-take-2.html&text=)
(https://plus.google.com/share?url=http://through-the-interface.typepad.com/through_the_interface/2009/06/batch-
processing-autocad-drawings-from-lisp-without-sdi-take-2.html) (http://www.facebook.com/sharer.php?
u=http%3A%2F%2Fthrough-the-interface.typepad.com%2Fthrough_the_interface%2F2009%2F06%2Fbatch-processing-
autocad-drawings-from-lisp-without-sdi-take-2.html)
17 Comments
1
HJohn •
Kean,
Do you have any plans for a blog on batch processing for .NET? I have been hopping for one on
that topic for a long time.
• •
Kean Walmsley •
HJohn,
Kean
• •
Stephan Bartl •
Hi Kean!
I would like to automatically continue my lisp-program (in the original drawing, which triggered the
script) after the execution of the script (or at least (re)start a lisp in that original dwg automatically).
3
Autodesk (http://autodesk.com/)