StevenMc Posted August 24, 2009 Posted August 24, 2009 Hi i was wondering if anyone could help me with a LISP... i have had a look around for a lisp that does "purge all" but havent had any luck. there seems to be alot of purge lisps out there but i cant see any with just purge all. its only the drawing that i'm in i want to purge. i have tried making it myself and will attach the simple steps i have (dont laugh) (Defun C:PA () (command "purge" "all" "") (princ) ) when i do this, this is what appears... All i want it to do is Just purge all cheers Steven Quote
gile Posted August 24, 2009 Posted August 24, 2009 Hi, You can try like this: (command "_.purge" "_all" "" "_no") And if you want to purge registred application too, add this: (command "_.purge" "_regapp" "" "_no") Quote
Lee Mac Posted August 24, 2009 Posted August 24, 2009 (defun c:pAll (/ doc) (vl-load-com) (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))) (repeat 3 (vla-PurgeAll doc)) (princ)) Quote
David Bethel Posted August 24, 2009 Posted August 24, 2009 Although the repeat 3 times has been around for years, it really doesn't guarentee that all nested blocks are purged. To insure DBMOD is set: (command "_.ZOOM" "_C" "" "") And then: [b][color=FUCHSIA]([/color][/b]while [b][color=NAVY]([/color][/b]> [b][color=MAROON]([/color][/b]getvar [color=#2f4f4f]"DBMOD"[/color][b][color=MAROON])[/color][/b] 0[b][color=NAVY])[/color][/b] [b][color=NAVY]([/color][/b]command [color=#2f4f4f]"_.PURGE"[/color] [color=#2f4f4f]"_All"[/color] [color=#2f4f4f]"*"[/color] [color=#2f4f4f]"_No"[/color][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] -David Quote
MarcoW Posted August 24, 2009 Posted August 24, 2009 In reverse: Lee what did I try when I give you the following error: no function definition: VLA-AUDITALL Right, thats what I tried. How to expand the routine so it will purge and audit. And then I mean not by... (command "audit" "y" ) ...but with some visual lisp. Thoughts: Such routine should run on startup of every drawing. That can be done very easily. Can it be done on "closing" the drawing? But not by adding the command "pAll" to the "save" button macro. For there is a s:startup function, maybe there is a s:close Quote
Lee Mac Posted August 24, 2009 Posted August 24, 2009 This could be achieved using a reactor to react on the close function (but on the WillStart, not the CommandEnded, otherwise you get some trouble!). And vla-AuditInfo is the function you are looking for - check it in the VLIDE help. Quote
StevJ Posted August 24, 2009 Posted August 24, 2009 I've got this macro tied to a button. I give the button two or three good whacks, and it pretty much cleans the junk outa my drawings: ^C^C-purge;a;*;n;-purge;r;*;n;-scalelistedit;R;Y;E; Quote
alanjt Posted August 24, 2009 Posted August 24, 2009 vla-PurgeAll is great, but i think everyone should be aware that it will NOT purge mleader styles. it completely ignores them. Quote
alanjt Posted August 24, 2009 Posted August 24, 2009 Didn't know that Alan, thanks yeah, i happened to notice it one day and had to go back to the (command "purge" for my startup. Quote
Lee Mac Posted August 24, 2009 Posted August 24, 2009 yeah, i happened to notice it one day and had to go back to the (command "purge" for my startup. Its a shame they don't include more VL options for the Purge side of things - I suppose you could DIY a code, but it probably wouldn't be too quick... Quote
alanjt Posted August 25, 2009 Posted August 25, 2009 Its a shame they don't include more VL options for the Purge side of things - I suppose you could DIY a code, but it probably wouldn't be too quick... interesting idea, maybe something like this: (defun MleaderStylePurge (/) (vl-remove-if 'null (mapcar '(lambda (x) (and (eq 350 (car x)) (not (eq 330 (car (nth 5 (entget (cdr x)))))) (not (eq (getvar "cmleaderstyle") (vla-get-name (vlax-ename->vla-object (cdr x))) ) ;_ eq ) ;_ not (entdel (cdr x)) ) ;_ and ) ;_ lambda (dictsearch (namedobjdict) "ACAD_MLEADERSTYLE") ) ;_ mapcar ) ;_ vl-remove-if ) ;_ defun returns nil if nothing or list of T (one for each style purged) Quote
Lee Mac Posted August 25, 2009 Posted August 25, 2009 Nice Alan, I don't know enough about the DXF for the MLeaderStyles for this one Will have to have a read... Quote
alanjt Posted August 25, 2009 Posted August 25, 2009 Nice Alan, I don't know enough about the DXF for the MLeaderStyles for this one Will have to have a read... thanks nor i, i'm crap at dxf (notice i converted it to a vla-object to compare style name). i just did a little compare and testing. interesting side note, you CAN delete a style, even if it's current and/or used. autocad will crash, but you can do it. my original thought was just vl-catch-all-apply and delete them, but it will delete it none-the-less. Quote
Lee Mac Posted August 25, 2009 Posted August 25, 2009 So you can delete the used Styles with no error - but it will error out afterward? Quote
alanjt Posted August 25, 2009 Posted August 25, 2009 So you can delete the used Styles with no error - but it will error out afterward? yes, that's why i had to put in so many checks. it's like entmod, you can freeze the current layer. Quote
Lee Mac Posted August 25, 2009 Posted August 25, 2009 yes, that's why i had to put in so many checks. it's like entmod, you can freeze the current layer. Ahh, ok thanks Quote
alanjt Posted August 25, 2009 Posted August 25, 2009 Ahh, ok thanks [ATTACH]14036[/ATTACH] now i'm thirsty. Quote
alanjt Posted August 25, 2009 Posted August 25, 2009 hey, what is the dxf code to select an attributed block? Quote
Lee Mac Posted August 25, 2009 Posted August 25, 2009 (66 . 1) Or to check def: (eq 2 (logand 2 (cdr (assoc 70 (tblsearch "BLOCK" "<blk>"))))) I normally use this: http://autodesk.com/techpubs/autocad/acad2000/dxf/ 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.