Keywordkid Posted April 28, 2015 Posted April 28, 2015 Hi All, It's been some time since I have been using AutoCAD and all the lisp controls I learnt have disappeared from memory. I basically only using CAD as a tool for cleaning files to link into Revit and so have been setting up a routine to run through all the clean and purge utilities to speed this up and remove the repetitiveness of using the same sequence of commands over and over. One utility I'd like to add into my lisp is "Flatten.lsp" I have found how to run it but is there anyway I can pre-answer the prompts? i.e. Flatten All (Return) Yes? Thanks in advance. Mark Quote
Keywordkid Posted April 28, 2015 Author Posted April 28, 2015 Hi All, It's been some time since I have been using AutoCAD and all the lisp controls I learnt have disappeared from memory. I basically only using CAD as a tool for cleaning files to link into Revit and so have been setting up a routine to run through all the clean and purge utilities to speed this up and remove the repetitiveness of using the same sequence of commands over and over. One utility I'd like to add into my lisp is "Flatten.lsp" I have found how to run it but is there anyway I can pre-answer the prompts? i.e. Flatten All (Return) Yes? Thanks in advance. Mark Quote
ReMark Posted April 28, 2015 Posted April 28, 2015 Please do not double post as it only leads to split answers and confusion. Thank you. Quote
ReMark Posted April 28, 2015 Posted April 28, 2015 How about using a script to batch process all the drawings? Quote
Keywordkid Posted April 28, 2015 Author Posted April 28, 2015 (edited) Apologises, it was a keyboard slip up. Any viewers please refer to "Run Another" thread. Edited April 28, 2015 by Keywordkid To point readers to the original thread Quote
ttray33y Posted April 28, 2015 Posted April 28, 2015 Hi All, It's been some time since I have been using AutoCAD and all the lisp controls I learnt have disappeared from memory. I basically only using CAD as a tool for cleaning files to link into Revit and so have been setting up a routine to run through all the clean and purge utilities to speed this up and remove the repetitiveness of using the same sequence of commands over and over. One utility I'd like to add into my lisp is "Flatten.lsp" I have found how to run it but is there anyway I can pre-answer the prompts? i.e. Flatten All (Return) Yes? Thanks in advance. Mark Of course you can. I have the same procedure. Purge > Audit > Flatten and so on. im only using a script btw in batch, run once & let autocad do the rest. Quote
Keywordkid Posted April 28, 2015 Author Posted April 28, 2015 That's good to know, could you provide an example? Quote
GP_ Posted April 28, 2015 Posted April 28, 2015 Try this: ;Gian Paolo Cattaneo - 28.Apr.2015 (defun c:FlattenAll () (if (and (zerop (car (getvar "viewdir"))) (zerop (cadr (getvar "viewdir"))) (> (caddr (getvar "viewdir")) 0) ) (if (member "acetutil.arx" (arx)) (progn (or acet-flatn (load "FLATTENSUP.LSP")) (acet-flatn (ssget "_X") nil) ) (alert "Express Tools are not installed.") ) (alert "View needs to be in plan (0 0 1).") ) (princ) ) Quote
ttray33y Posted April 29, 2015 Posted April 29, 2015 That's good to know, could you provide an example? it goes something like this. BURST ALL SCALE ALL 0,0,0 25.4 ZOOM E -PURGE ALL * N CHANGE ALL P C 7 CLOSE N Quote
Keywordkid Posted April 29, 2015 Author Posted April 29, 2015 Thanks Everyone, I'll give these suggestions a try. I did get flatten to work by saving a .scr and then running it from my lisp but it's a bit clunky and means I have two files to deal with instead of one lisp routine, I like the look of GP's example for running straight from the one file. I'll report back how I get on, when I get a chance to jump back on AutoCAD. Cheers, KYK Quote
ttray33y Posted April 30, 2015 Posted April 30, 2015 Thanks Everyone, I'll give these suggestions a try. I did get flatten to work by saving a .scr and then running it from my lisp but it's a bit clunky and means I have two files to deal with instead of one lisp routine, I like the look of GP's example for running straight from the one file. I'll report back how I get on, when I get a chance to jump back on AutoCAD. Cheers, KYK Call your .scr from a batch file like this, this batch file will call all drawings inside C:\DATAFILES\DWG opening it and running the script 1 drawing at a time. md C:\DATAFILES\prj\DWG\UPDATED for %%f in (C:\DATAFILES\DWG\*.dwg) do START /WAIT c:\"program files"\"Autodesk"\"AutoCAD 2011"\acad.exe "%%f" /b c:\datafiles\cleanME.scr This is what inside my batch (.bat) file. -xref BIND * -LAYER U * (load "C:\\DATAFILES\\CLEANUP UTIL.lsp") ;;silent loading my LISP loadLT ;;loads my custom linetype delob ;;delete hidden objects selectREM ;;delete all remarks selectpoints ;;delete all Points selectWO ;;delete wipeouts (bup "C:\\DATAFILES\\KNPC\\KNPC MAB NEW A1 BORDER_DWG.dwg") ;;bup is a command for redifining blocks inside my drawing, this will ensure that those blocks is up to date. (bup "C:\\DATAFILES\\prj\\BALL DRAIN.dwg") (bup "C:\\DATAFILES\\prj\\BALL DRAIN VERTICAL.dwg") (bup "C:\\DATAFILES\\prj\\BALL VENT.dwg") (bup "C:\\DATAFILES\\prj\\DRAIN 2.dwg") (bup "C:\\DATAFILES\\prj\\DRAIN 3.dwg") (bup "C:\\DATAFILES\\prj\\VENT 2.dwg") ZOOM E FORCE ;;Lisp to force all to ByLayer changestylefont ;;changes the fonts of some the text styles to comply project requirement. -PURGE ALL * N CHANGE ALL P C 7 border_update ;;saves a copy of the updated drawing to C:\DATAFILES\prj\DWG\UPDATED and leaves the original copy untouch.(so if something goes wrong you have a backup) QUIT Y without this routine it will take me 1-2hrs cleaning up the 1 drawing, but with this it only take me 8 mins. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.