Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Batch Routines

19 REPLIES 19
Reply
Message 1 of 20
Anonymous
571 Views, 19 Replies

Batch Routines

I have spent days looking on the web searching for a rountine i can use to run processes on a large number of files. For some reason my company opted out of AutoCads batch plot utility so i am on my own. Here is what i would like to have ...if possible.

I need a routine I can run where I select a large set of files and run any process I want on them.
I want it to open the file, run the command then close it and open the next one on the list. So on and so forth.

I appreciate any help
19 REPLIES 19
Message 2 of 20
Anonymous
in reply to: Anonymous
Message 3 of 20
Anonymous
in reply to: Anonymous

Thanks that looks like it would work but it takes years to get the Admin rights to download stuff here. I will try though in the meantime.
Message 4 of 20
devitg
in reply to: Anonymous

You can handle it via

"ObjectDBX.AxDbDocument


Message 5 of 20
Anonymous
in reply to: Anonymous

;*************************************************************
;;Written By: Paul
;******************************************************************
Try this if you need help let me know.

LIsp file

(setvar "cmdecho" 0)
(setvar "expert" 4)
(setvar "cmddia" 0)
(setvar "filedia" 0)
(setvar "lispinit" 1)



(setq ins 0)

(setq dirpath (acet-ui-pickdir))
(setq dirp (strcat dirpath "\\"))
(setq plist (vl-directory-files dirp "*.dwg" 1))

;(setq plist (vl-directory-files (getvar "dwgprefix") "*.dwg" 1))


(defun lmake ()
(setq yy (get_tile "l1"))
);defun

(defun mk_list (/ count item retlist)
(setq count 1)
(while (setq item (read yy))
(setq retlist (cons (nth item plist) retlist))
(while (and (/= " " (substr yy count 1))
(/= "" (substr yy count 1)))
(setq count (1+ count))
)
(setq yy (substr yy count))
)
(setq ww (reverse retlist))
(setq ins1 (nth ins ww))
)

(DEFUN WGCH ()
(SETVAR "CMDECHO" 0)
(SETVAR "EXPERT" 4)

(while (/= ins1 nil)
(setvar "lispinit" 0)
(command "open" (strcat dirp ins1) )
;"insert" (strcat "*" ins1) "0,0" "" "");no explode


;;;;place the commands you want to do on .dwgs between here

(setq ss (ssget "all"))

(command "change" "p" "" "p" "la" "annotation" "") ;do your command here

(command "save" ins1)

;;;and here


(setq ins (+ ins 1))
(setq ins1 (nth ins ww))
);while
(princ));defun

(defun gout ()
(setvar "expert" 0)
(setvar "cmddia" 1)
(setvar "filedia" 1))

(defun C:JB ( / dcl_id)
(setq dcl_id (load_dialog "mprg.dcl"))
(if (not (new_dialog "mprg" dcl_id) ) (exit))
(action_tile "accept" "(gout)(mk_list)(done_dialog)")
(action_tile "cancel" "(gout)(done_dialog)")
(start_list "l1")
(mapcar 'add_list plist)
(end_list)
(start_dialog)
(unload_dialog dcl_id)
(wgch)
(SETQ PLIST NIL)
(setvar "lispinit" 1)
(princ))

dcl file

mprg : dialog {
label="BATCH FILES";
initial_focus="l1";

:boxed_column{
//label="Sel";

:row{
:column{


:boxed_row {
:list_box {
label="Select Drawings";
key="l1";
action= "(lmake)";
multiple_select=true;
width=60;
}
}


}
}
}
ok_cancel;
}

southie
Message 6 of 20
Anonymous
in reply to: Anonymous

A few questions
1. Besides just opening a file what is the command to use this function.
2. I inserted (command "-plot" "N" "Model" "" "Adobe PDF.pc3" "N" "Y" "Y") where you had marked in the lisp and then selected a few files. after that it did nothing? Did I do something wrong?
Message 7 of 20
Anonymous
in reply to: Anonymous

Once you load the lisp file type jb at the command prompt you should get a dialog box to choose a folder then a dialog box with the .dwg files you want to execute your commands on. Did you get the dialogs?

southie
Message 8 of 20
Anonymous
in reply to: Anonymous

okay, I did get the dialogue and i selected the folder accordingly but then nothing happened.
Message 9 of 20
Anonymous
in reply to: Anonymous

After choosing folder type jb at command prompt you should get another dialog box with drawings choose which .dwgs you want to do commands to.
Message 10 of 20
Anonymous
in reply to: Anonymous

"JB" doesnt do anything. Even if I type it before or after.
The routine actually kicks off everytime I open the file? Edited by: jgoduti@cvs.com on Dec 30, 2008 11:53 AM
Message 11 of 20
Anonymous
in reply to: Anonymous

Did you name the .dcl file mprg.dcl ?
Message 12 of 20
Anonymous
in reply to: Anonymous

No I did not......I am new at this if you can't tell 🙂
So I take the above lisp and use it as a .dcl or .lsp? right now i used it as a .lsp and that is what i am having the issue with. Please feel free to email if necessary.
Thank you again
Message 13 of 20
Anonymous
in reply to: Anonymous

jg

There were two files in my orig post. One was a lisp file below it was a .dcl file. Copy and paste .dcl and name it mprg.dcl If you get a chance let me know if it works.
Message 14 of 20
Anonymous
in reply to: Anonymous

ahhh I missed that
Does it matter where I put the .dcl file?
Message 15 of 20
Anonymous
in reply to: Anonymous

I would put it in the library search path (folder where acad.exe is located) same place for the lisp file. If not folder where drawings are.
Message 16 of 20
Anonymous
in reply to: Anonymous

Ok I put the files in the correct spot but I still get the file select screen when I open a drawing. JB will not bring up the original folder selection screen.
Also i am able to select a folder then type "jb" and the file selection screen pops up but it is empty. Can I not pick a folder full of folders with DWGs?
Message 17 of 20
Anonymous
in reply to: Anonymous

You must point to the folder where drawings are located. All drawings in picked folder will display in select dialog. The select dialog is multi pick allowing for custom selections.
Message 18 of 20
Anonymous
in reply to: Anonymous

I still cannot bring up the folder selection screen when i want to.
Is there anyway for this lisp to select multiple folders?
see i have a folder hierarchy set up like so:
Drawing # folder
--------Ground Folder
--------------Revision folder
-----------------------actual drawing file

I would like to be able to select multiple drawing folders.

Thank you
Message 19 of 20
Anonymous
in reply to: Anonymous

You might have to revert to "Scriptpro" as JP mentioned before. i have seen alot of neat batch programs on this site. Maybe search this site again. What i posted was a quick and dirty utility nothing fancy but has been a big time saver for me.
Message 20 of 20
Anonymous
in reply to: Anonymous

Ok I will try and get that.
Thanks

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost