Jump to content

Recommended Posts

Posted

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...

 

untitled.jpg

 

All i want it to do is Just purge all :)

 

cheers

Steven

  • Replies 25
  • Created
  • Last Reply

Top Posters In This Topic

  • alanjt

    10

  • Lee Mac

    10

  • StevenMc

    2

  • gile

    1

Top Posters In This Topic

Posted Images

Posted

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")

Posted
(defun c:pAll (/ doc)
 (vl-load-com)
 (setq doc (vla-get-ActiveDocument
             (vlax-get-acad-object)))
 (repeat 3 (vla-PurgeAll doc))
 (princ))

Posted

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

Posted

:D 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 :unsure:

Posted

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. :)

Posted

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;

Posted

vla-PurgeAll is great, but i think everyone should be aware that it will NOT purge mleader styles. it completely ignores them.

Posted
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.

Posted
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...

Posted
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)

Posted

Nice Alan,

 

I don't know enough about the DXF for the MLeaderStyles for this one :(

 

Will have to have a read... o:)

Posted
Nice Alan,

 

I don't know enough about the DXF for the MLeaderStyles for this one :(

 

Will have to have a read... o:)

:) 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.

Posted

So you can delete the used Styles with no error - but it will error out afterward?

Posted
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.

Posted
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 Pepsi.gif

Posted
Ahh, ok thanks [ATTACH]14036[/ATTACH]

now i'm thirsty.

Posted

hey, what is the dxf code to select an attributed block?

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...