I'm new to Cad customization, playing with small routine and modifying Menu. I posted some questions before but still trying to resolve problems. I added code in acaddoc.lsp and it working fine but when add (command "close") I'm getting a message "AtuoCAD connot close P:\drive nameandfile..........dwg, because there is a command still active. please complete the command and try again. I'm trying to clearup all dwgs. so I can open all dwgs from Windows Explorer. (command "purge" "all" "*" "no") (command "audit" "y") (Command "zoom" "e") (command "qsave") (command "close") again, is anybody know how to turn off pagesetup and stardard dialog Box. same as turn off file and plot dialog - FILEDIA, CMDDIA to 0 Thanks for your help John
John, AcadDoc.lsp is *not* the place for this code. Any drawing you open would immediately close, if it worked as you intend. I guess that means you could go home early... Command: (command "._psetupin") .._psetupin Enter file name: nil Enter file name: For the Standards command, are you just wanting to do a Layer Translate, or more? -- R. Robert Bell I'm new to Cad customization, playing with small routine and modifying Menu. I posted some questions before but still trying to resolve problems. I added code in acaddoc.lsp and it working fine but when add (command "close") I'm getting a message "AtuoCAD connot close P:\drive nameandfile..........dwg, because there is a command still active. please complete the command and try again. I'm trying to clearup all dwgs. so I can open all dwgs from Windows Explorer. (command "purge" "all" "*" "no") (command "audit" "y") (Command "zoom" "e") (command "qsave") (command "close") again, is anybody know how to turn off pagesetup and stardard dialog Box. same as turn off file and plot dialog - FILEDIA, CMDDIA to 0 Thanks for your help John
John, Don't know if it will shut off all the dialogs..but you could try. .... (setvar "EXPERT" 5) .... do your changes.... ... (setvar "EXPERT" 2) ... (command ".qsave") bob
Bell, Thank you for your reply. I do have psetupin routine (command "PSETUPIN" "PLOT 1050C STANDARD.dwt" "*") how do you tell to cad which page setup name need to be current after installed several setup pages name? There are two commands psetupin and pagesetup. Yes, I want to close dwg immedialely after finish code. I want cleanup every dwgs on server. So if I select dwgs as many as i can from Window Explorere it open and run all code and close immedialely...... John
You have to use the CopyFrom method on the Layouts that you want to apply the page setup to. Search both here and in the VBA ng for sample code. There are all sorts of ways to batch process drawings. Again, a search here will yield many options, such as ScriptPro. -- R. Robert Bell Bell, Thank you for your reply. I do have psetupin routine (command "PSETUPIN" "PLOT 1050C STANDARD.dwt" "*") how do you tell to cad which page setup name need to be current after installed several setup pages name? There are two commands psetupin and pagesetup. Yes, I want to close dwg immedialely after finish code. I want cleanup every dwgs on server. So if I select dwgs as many as i can from Window Explorere it open and run all code and close immedialely...... John
John I do something very similar when I want to plot a whole load of drawigs, or like you say clean them up. Below is the code I have in my ACAD.lsp file: Defun S::Startup () (Princ) (command "cmdecho" "0") (COMMAND "IMAGEFRAME" "OFF") (COMMAND "CMDDIA" "1") (princ "\n") ;;(COMMAND "PDMODE" "0")(princ "\n") ;;SETS THE POINT MODE TO A POINT RATHER THAN CROSS ETC. (command "regenauto" "on") ;;(COMMAND "LTSCALE" "1") ;;(COMMAND "TILEMODE" "0") ;;(COMMAND "CMDDIA" "0") ;;(command "-layer" "off" "amend" "") ;;(COMMAND "_PLOT" "n" "" "<previous plot>" "" "" "y" "") ;;(COMMAND "_PLOT" "Y" "" "hp5000.pc3" "A3" "M" "L" "N" "W" "19.5,14.0" "833.0,574.5" "1=2" "C" "Y" "CW Half.ctb" "Y" "N" "N" "N" "N" "Y" "Y") ;;(COMMAND "_PLOT" "Y" "" "XEROX 8830.pc3" "ISO B1 (706.00 x 1000.00 MM)" "M" "L" "N" "W" "10,7.5" "991,697.5" "1=1" "C" "Y" "RDH Standard.ctb" "Y" "N" "N" "N" "Y" "" "Y" "Y") ;;(COMMAND "_PLOT" "Y" "" "XEROX 8830.pc3" "ISO A1 (841.00 x 594.00 MM)" "M" "L" "N" "W" "19.5,14.0" "833.0,574.5" "1=1" "C" "Y" "CW Standard.ctb" "Y" "N" "N" "N" "Y" "" "Y" "Y") ;;(COMMAND "_PLOT" "Y" "" "PostScript Level 1 Plus.pc3" "ISO A1 (841.00 x 594.00 MM)" "M" "L" "N" "W" "19.5,14.0" "833.0,574.5" "1=1" "C" "Y" "CW STANDARD.ctb" "Y" "N" "N" "N" "N" "Y" "Y") ;;(COMMAND "ZOOM" "EXTENTS") ;;(COMMAND "QSAVE") ;;(COMMAND "CLOSE") ) (princ "\n") I simply remove the semicolons in front of the lines that I want to use and then replace then when I am done. That way I can open 20 or 30 drawings sit back and supervise as my computer makes sure every drawing is consistently worked on. For what you want maybe below would work: Defun S::Startup () (Princ) (command "cmdecho" "0") (COMMAND "IMAGEFRAME" "OFF") (COMMAND "CMDDIA" "1") (princ "\n") (COMMAND "PDMODE" "0")(princ "\n") ;;SETS THE POINT MODE TO A POINT RATHER THAN CROSS ETC. (command "regenauto" "on") (COMMAND "LTSCALE" "1") (COMMAND "TILEMODE" "0") (COMMAND "CMDDIA" "0") (command "purge" "all" "*" "no") (command "audit" "y") (COMMAND "ZOOM" "EXTENTS") (COMMAND "QSAVE") (COMMAND "CLOSE") ) (princ "\n") I would suggest the problem you are having is that is that the CMDDIA variable is set to 1 try adding the lines I have above that set it to 0. You will not that it is first set to 1 above, this is so I can have command dialouge boxes normmally as normally I would have the second call to change the variable to 0 supressed. Hope this helps, Daniel.
Daniel, Thank you for your reply. I use batch plot utility and i call-out pagesetup names from BPU when I want to plot a entire project. For cleanup drawings I used your code but still I'm gettting same message "AtuoCAD connot close P:\drivenameandfile..........dwg, because there is a command still active. please complete the command and try again." at close command. is closing drawing for you at close commend or are you getting same message? I'm using 2002 ADT. John
John, I accidently ommited the opening parenthis, this may be causing the problem. The routine should be as follows: (Defun S::Startup () (Princ) (command "cmdecho" "0") (COMMAND "IMAGEFRAME" "OFF") (COMMAND "CMDDIA" "1") (princ "\n") (COMMAND "PDMODE" "0")(princ "\n") ;;SETS THE POINT MODE TO A POINT RATHER THAN CROSS ETC. (command "regenauto" "on") (COMMAND "LTSCALE" "1") (COMMAND "TILEMODE" "0") (COMMAND "CMDDIA" "0") (command "purge" "all" "*" "no") (command "audit" "y") (COMMAND "ZOOM" "EXTENTS") (COMMAND "QSAVE") (COMMAND "CLOSE") ) (princ "\n") I am using AutoCAD 2002 and I ran the routine sucessfully after fixing the error. If this doesn't work maybe there is a small difference between vanilla and ADT. Also note this code stumbles if a drawing has read only attributes or has never been previously saved before (not an issue here but I use the last 3 lines in a routine I call Qclose which safely saves and closes a drawing by typing Ctrl+Q. It is so good I can't believe that it's not a standard feature.) Daniel.
Wonderful, it works great. I want to know what I was doing wrong that causing the problem with my code. I thought I don't have to use following code: (defun s::starup () ; The acaddoc.lsp file is intended to be associated with each document (or drawing) initialization. This file is useful if you want to load a library of AutoLISP routines to be available every time you start a new drawing (or open an existing drawing). Each time a drawing opens, AutoCAD searches the library path for an acaddoc.lsp file. If it finds one, it loads the file into memory. The acaddoc.lsp file is always loaded with each drawing regardless of the settings of ACADLSPASDOC and LISPINIT.? (command "cmddia" "1") any lisp routine shut off all the dialogs? See what I was doing wrong with these code (command "purge" "all" "*" "no") (command "audit" "y") (Command "zoom" "e") (command "qsave") (command "close") Thank you for your help John
John, The S::Startup function doesn't run until the drawing is fully loaded, and AutoCAD is ready to go to work. Your code, not wrapped in S::Startup, was probably trying to close the drawing before it was even fully open. -- R. Robert Bell Wonderful, it works great. I want to know what I was doing wrong that causing the problem with my code. I thought I don't have to use following code:
John and others, A little tip when using this type of routine on a bunch of drawings is to do a small test run first to check it all works ok, otherwise you have to put an axe through your machine to stop it. (learnt the hard way) Daniel
Bell and Daniel Thank you for your help. Yes. I just try one or two drawings for test...... if it run ok i select as many as I need John