SpeakNoEvil Posted June 8, 2010 Share Posted June 8, 2010 Hello all, You've given such outstanding help in the past, I'm optimistic that this will be easily solvable as well. I wrote a "Smart Close" MACRO to automatically perform some cleanup/tidying steps before a file is closed. (The goal is to help other engineers in my department get more clean and consistent with their files.) Specifically, you click the button and it executes the MACRO ^C^C_TILEMODE;0;_AUDIT;Y;_-LA;S;0;;_Z;E;_LWDISPLAY;ON;_VISRETAIN;1;_MVIEW;L;ON;ALL;;_qsave;_close; Which: Switches to Paperspace Runs an Audit Sets the current layer to 0 Zooms to the extents of the page Turns the lineweight display on Saves the on/off visibility settings for all layers Locks all viewports Saves the sheet Closes the sheet Admittedly, I'm a bit new at MACROS, so my formatting may be a bit unorthodox. It works great though, and I tend to use it in place of my usual close button. FIRST: does anyone have any suggestions for other things to add to the list? SECOND: I'm having a small problem with it. If there aren't any viewports in Paperspace for a particular file, it hiccups at the "lock viewports" part and exits out of the MACRO - leaving me to manually save and close. Any suggestions on how to make it run smoothly regardless of the presence/absence of viewports? I'm fairly sure you could solve this in LISP, but I don't know any LISP and I feel like the amount of work to turn it to a LISP code is substantially more than the work of just saving and closing manually. (I even made a separate MACRO to do that in one step too.) Any suggestions on a fix to the hiccup? Please let me know, and thank you in advance! TC Quote Link to comment Share on other sites More sharing options...
Nardino Posted June 8, 2010 Share Posted June 8, 2010 ^C^CZ;E;-purge;all;*;n;audit;y;-purge;all;*;n;-overkill;all;;; try this Quote Link to comment Share on other sites More sharing options...
SpeakNoEvil Posted June 8, 2010 Author Share Posted June 8, 2010 Thanks for the response, Nardino! I've done a manual routine like that before, but in this case I'm shooting for something a little less destructive. A lot of things get deleted in that process, and since it all happens at once, then saves and closes, there's no opportunity for an undo button - and I'd like the changes to be reversible. I may make a new routine for that set of tasks separately, though. Quote Link to comment Share on other sites More sharing options...
Nardino Posted June 8, 2010 Share Posted June 8, 2010 actually in this little script i enclosed, there is no save command in there, leaving it up to you to decide if you should save or not. i have used it many times without any problems. Quote Link to comment Share on other sites More sharing options...
kevinp Posted June 28, 2010 Share Posted June 28, 2010 I have almost the same exact macro (im stealing the lock viewport bit - I LIKE!), but I add in addition: -scalelistedit;reset;yes;exit; because when we insert some xrefs and blocks we get hundreds of xrefed scales listed, and this cleans it up and makes it a bit nicer. Very quick to run the command too. Quote Link to comment Share on other sites More sharing options...
T704 Posted June 28, 2010 Share Posted June 28, 2010 I like this would like to use here in our office..... however don't know how to run much less install a Macro. Quote Link to comment Share on other sites More sharing options...
MSasu Posted June 28, 2010 Share Posted June 28, 2010 don't know how to run much less install a Macro. You don't have to install it - just create a new button on your toolbars and paste the code above under Macro field. Regards Quote Link to comment Share on other sites More sharing options...
SpeakNoEvil Posted June 28, 2010 Author Share Posted June 28, 2010 T704, Don't worry, it's pretty easy, actually. Here's a video showing how to do it; the interface is in Russian, but it's still straightforward. http://s004.radikal.ru/i205/1001/e0/7bdeb274a818.gif The gist of it is this: Go into CUI Click “new” under Command List Give your new command a title (e.g. Smart Close), and paste the Macro above into the Macro field. Give it an icon by selecting from the library. Choose the toolbar where you want it to go and drag the command from the command list (bottom left) to the tool. Here's a good intro if you want to try making your own; there's probably a great overview here on CADTutor as well, no doubt. http://www.cadalyst.com/cad/autocad/circles-and-lines-the-cui-and-macro-madness-3181 Quote Link to comment Share on other sites More sharing options...
T704 Posted June 28, 2010 Share Posted June 28, 2010 AS always .............Thanks Again Guys!! Quote Link to comment Share on other sites More sharing options...
SpeakNoEvil Posted August 17, 2010 Author Share Posted August 17, 2010 Thought I'd update everyone, in case you wanted to use the code. I've added one more handy function that was kind of a pain to make; the "Smart Close" now also selects all the viewports in the drawing and sets them to my standard viewport layer. The added script is in bold. ^C^C_TILEMODE;0;_AUDIT;Y;_-LA;S;0;;_-COLOR;BYLAYER;-linetype;set;bylayer;;_Z;E;_LWDISPLAY;ON;_VISRETAIN;1;_ssx;;e;viewport;;-ch;p;;p;la;"SE VIEWPORT";;_qsave;_close; I've also created a similar function called "Smart Clean," which does everything the Smart Close does, regens and keeps the file open instead of closing it. ^C^C_TILEMODE;0;_AUDIT;Y;_-LA;S;0;;_-COLOR;BYLAYER;-linetype;set;bylayer;;_Z;E;_LWDISPLAY;ON;_VISRETAIN;1;_ssx;;e;viewport;;-ch;p;;p;la;"SE VIEWPORT";;_RE;_QSAVE; You'll want to change the "SE VIEWPORT" to the name of the layer you want viewports on, of course. It uses a function called SSX, which I find very handy but somewhat disconcerting. Does anyone else know about this "hidden selection set" it creates? Am I tampering with forces greater than I understand by using it? Can I clear it somehow? Hope these help! Quote Link to comment Share on other sites More sharing options...
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.