Author Topic: Silent Purge  (Read 6528 times)

0 Members and 1 Guest are viewing this topic.

CADaver

  • Guest
Silent Purge
« on: June 17, 2005, 10:48:32 AM »
I want to automatically purge SOME stuff (I sorta know about vla-purgeall), not everything.  Anyway, I hobbled together a routine using  (command "-purge" and works fine EXCEPT it echos whats being purged to the screen (even when CMDECHO is off). <see below>  Is there some way to so this silently?  Or some other way entirely, that will "auto" purge specific stuff without kicking up a fuss?

    Deleting dimension style "dim120".
    Deleting dimension style "Standard".
    2 dimension styles deleted.
    Deleting linetype "HANDRAIL".
    Deleting linetype "MATCHLINE".
    Deleting linetype "REBAR-01".
    Deleting linetype "REBAR02".
    Deleting linetype "REBAR04".
    Deleting linetype "REBAR05".
    Deleting linetype "TOPLINE23".
    7 linetypes deleted.
    Deleting plotstyle "ByLayer".
    Deleting plotstyle "Extra Thin".
    Deleting plotstyle "Medium".
    Deleting plotstyle "Style_1".
    Deleting plotstyle "Style_2".
    Deleting plotstyle "Style_3".
    Deleting plotstyle "Style_4".
    7 plotstyles deleted.
    Deleting text style "btxt120".
    Deleting text style "btxt240".
    Deleting text style "Dimn".
    Deleting text style "txt120".
    4 text styles deleted.
    Deleting shape file "ltypeshp.shx".
    1 shape file deleted.
    [/list:u]

    daron

    • Guest
    Silent Purge
    « Reply #1 on: June 17, 2005, 10:57:42 AM »
    Purge all and save. Currently set to purge four times. You can set it to whatever you desire.
    Code: [Select]
    ;;;=====================================================================;
    ;;;Purgeall and save ;
    ;;;=====================================================================;
    (defun c:purgesave (/ $acad $doc)
         (setq $doc (vla-get-activedocument (vlax-get-acad-object)))
         (repeat 4
     (vla-purgeall $doc)
         )
         (vla-save $doc)
         (vlax-release-object $doc)
         (princ
     "\nDrawing has been completely purged and successfully saved. "
         )
         (princ)
    )
    You can also remove the vla-save if you don't wish to autosave.

    MP

    • Seagull
    • Posts: 17750
    • Have thousands of dwgs to process? Contact me.
    Silent Purge
    « Reply #2 on: June 17, 2005, 10:57:44 AM »
    I don't think so Randy. I don't think qaflags will stifle it either. You'd probably have to hand roll some arx.
    Engineering Technologist CAD Automation Practitioner
    Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
    cadanalyst@gmail.com http://cadanalyst.slack.com http://linkedin.com/in/cadanalyst

    daron

    • Guest
    Silent Purge
    « Reply #3 on: June 17, 2005, 10:58:56 AM »
    Will mine do it? I've never had a problem. Did I not understand the question?

    MP

    • Seagull
    • Posts: 17750
    • Have thousands of dwgs to process? Contact me.
    Silent Purge
    « Reply #4 on: June 17, 2005, 10:59:49 AM »
    Quote from: daron
    Purge all and save. Currently set to purge four times. You can set it to whatever you desire ... <snip> ...You can also remove the vla-save if you don't wish to autosave.

    Umm:
    Quote from: Randy
    I want to automatically purge SOME stuff (I sorta know about vla-purgeall), not everything.
    Engineering Technologist CAD Automation Practitioner
    Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
    cadanalyst@gmail.com http://cadanalyst.slack.com http://linkedin.com/in/cadanalyst

    CADaver

    • Guest
    Silent Purge
    « Reply #5 on: June 17, 2005, 11:02:49 AM »
    Quote from: MP
    I don't think so Randy. I don't think qaflags will stifle it either. You'd probably have to hand roll some arx.
    I played with qaflags a little but didn't see a way around it there.  Looks like I'll live with the echo for a while.

    Daron, I just want to purge SOME stuff, not all.  I have a function (surprisingly similar to yours) that does a purge ALL, but I don't want to purge Blocks and Layers, just everything else.

    MP

    • Seagull
    • Posts: 17750
    • Have thousands of dwgs to process? Contact me.
    Silent Purge
    « Reply #6 on: June 17, 2005, 11:06:27 AM »
    A cludgy work around would be to make a reference to anything you do wish to keep (that is currently not referenced), say a block def, a layer or a text style, do a vla-purgeall, then delete the temporary references. Would require a fair bit of coding, albeit mostly trivial.
    Engineering Technologist CAD Automation Practitioner
    Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
    cadanalyst@gmail.com http://cadanalyst.slack.com http://linkedin.com/in/cadanalyst

    daron

    • Guest
    Silent Purge
    « Reply #7 on: June 17, 2005, 11:07:02 AM »
    Quote from: MP
    Quote from: daron
    Purge all and save. Currently set to purge four times. You can set it to whatever you desire ... <snip> ...You can also remove the vla-save if you don't wish to autosave.

    Umm:
    Quote from: Randy
    I want to automatically purge SOME stuff (I sorta know about vla-purgeall), not everything.


    Saw that. Didn't read well to me. Heh. I don't even use mine anymore because if I purge any blocks or layers it kills the whole program I have to use. Poor scripting. example: "layer" "s"...:?: Grrr.

    CADaver

    • Guest
    Silent Purge
    « Reply #8 on: June 17, 2005, 11:41:31 AM »
    Quote from: MP
    Would require a fair bit of coding, albeit mostly trivial.
    ummm... I can live with the echos, just hoping for an "Easy Button".

    CADaver

    • Guest
    Silent Purge
    « Reply #9 on: June 17, 2005, 11:50:46 AM »
    BTW, Daron, I have one from D.M. Stien's Visual Lisp Bibile.

    Jeff_M

    • King Gator
    • Posts: 4093
    • C3D user & customizer
    Silent Purge
    « Reply #10 on: June 17, 2005, 12:59:40 PM »
    Randy, will this work for ya? I wasn't able to determine where the Shape file info is stored......
    Code: [Select]

    (defun c:cpurge (/ doc)
      (setq doc (vla-get-activedocument (vlax-get-acad-object)))
      (mapcar '(lambda (col)
        (vlax-for x col
          (vl-catch-all-apply 'vla-delete (list x))
          )
        )
     (list (vla-get-dimstyles doc) (vla-get-linetypes doc)
    (vla-get-textstyles doc) (vla-get-plotconfigurations doc)
    )
     )
      (princ)
      )

    whdjr

    • Guest
    Silent Purge
    « Reply #11 on: June 17, 2005, 01:12:54 PM »
    Schweeeeet!!

    Although you left out Layers and Blocks!

    Very Cool Jeff!!!

    I likes alot! :D  :D  :D  
    :dood:  :dood:  :dood:

    Jeff_M

    • King Gator
    • Posts: 4093
    • C3D user & customizer
    Silent Purge
    « Reply #12 on: June 17, 2005, 02:47:51 PM »
    Quote from: whdjr

    Although you left out Layers and Blocks!

    Very Cool Jeff!!!
    Thanks!
    As for leaving things out.......
    Quote from: CADaver
    .... but I don't want to purge Blocks and Layers, just everything else.


     8)

    whdjr

    • Guest
    Silent Purge
    « Reply #13 on: June 17, 2005, 02:50:09 PM »
    :?

    sorry

    CADaver

    • Guest
    Silent Purge
    « Reply #14 on: June 17, 2005, 04:22:29 PM »
    That's pretty cool, thanks, but it's not getting rid of PLOTSTYLES that can be PURGEd.  
    Any ideas?

    Jeff_M

    • King Gator
    • Posts: 4093
    • C3D user & customizer
    Silent Purge
    « Reply #15 on: June 17, 2005, 06:16:45 PM »
    Here ya go. I don't use plotstyles so I tried this on a small test dwg and it appearred to work. If it doesn't work like you think it should, let me know and I'll investigate further.
    Code: [Select]

    (defun c:cpurge (/ doc del_itms pstyl n namelist styls sub)
      (setq doc (vla-get-activedocument (vlax-get-acad-object)))
      (setq pstyl (vla-item (vla-get-dictionaries doc) "ACAD_PLOTSTYLENAME"))
      (mapcar '(lambda (col)
        (vlax-for x col
          (vl-catch-all-apply 'vla-delete (list x))
          )
        )
     (list (vla-get-dimstyles doc) (vla-get-linetypes doc)
    (vla-get-textstyles doc) (vla-get-plotconfigurations doc)
    )
     )
      (vlax-for lay (vla-get-layers doc)
        (if (not (member (vla-get-plotstylename lay) namelist))
          (setq namelist (cons (vla-get-plotstylename lay) namelist))
          )
        )
      (setq styls (entget (vlax-vla-object->ename pstyl))
    sub (member (assoc 3 styls) styls)
    sub (reverse (cddr (reverse sub)))
    n 0)
      (while (< (setq n (+ n 2)) (1- (length sub)))
        (if (not (member (cdr (nth n sub)) namelist))
          (setq del_itms (cons (vla-get-objectid (vlax-ename->vla-object (cdr (nth (1+ n) sub)))) del_itms))
          )
        )
      (vlax-for itm pstyl
        (if (member (vla-get-objectid itm) del_itms)
          (vla-delete itm)
          )
        )  
      (princ)
      )

    MP

    • Seagull
    • Posts: 17750
    • Have thousands of dwgs to process? Contact me.
    Silent Purge
    « Reply #16 on: June 17, 2005, 07:29:04 PM »
    Of course, excellent outside the box solution Jeff.  I use the technique for blowing away appids, why not other tables.

    <KickSelfForMissingTheObvious.mpg>

    :)
    Engineering Technologist CAD Automation Practitioner
    Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
    cadanalyst@gmail.com http://cadanalyst.slack.com http://linkedin.com/in/cadanalyst

    CADaver

    • Guest
    Silent Purge
    « Reply #17 on: June 17, 2005, 08:08:59 PM »
    Wayyy cool Jeff, thanks a heap.  I knew somebody 'round here had the answer.

    Chuck Gabriel

    • Guest
    Silent Purge
    « Reply #18 on: June 17, 2005, 10:36:27 PM »
    I may be a little late with this, but maybe it will come in handy in the future.  There is a system variable called NOMUTT.  If you set it to one, nothing (and I mean nothing) will appear on the command line unless you specifically put it there.

    CADaver

    • Guest
    Silent Purge
    « Reply #19 on: June 18, 2005, 08:19:53 AM »
    I dunno, I couldn't get NOMUTT to work with PURGE.

    Jeff_M

    • King Gator
    • Posts: 4093
    • C3D user & customizer
    Silent Purge
    « Reply #20 on: June 19, 2005, 11:17:08 AM »
    The first thing I tried was NOMUTT. Somehow, Purge overrides the NOMUTT setting and lists everything purged, or not, no matter what.

    ronjonp

    • Needs a day job
    • Posts: 7527
    Silent Purge
    « Reply #21 on: June 20, 2005, 11:13:04 AM »
    On another topic.......how would you change the drawing viewres silently?

    Windows 11 x64 - AutoCAD /C3D 2023

    Custom Build PC

    daron

    • Guest
    Silent Purge
    « Reply #22 on: June 20, 2005, 11:16:15 AM »
    cmdecho 0?

    Jeff_M

    • King Gator
    • Posts: 4093
    • C3D user & customizer
    Silent Purge
    « Reply #23 on: June 22, 2005, 04:47:31 PM »
    Quote from: ronjonp
    On another topic.......how would you change the drawing viewres silently?
    Well, contrary to what the help file says, VIEWRES is NOT a System Variable, so a simple (setvar "viewres" 10000) is out ......
    However, this setting is stored for each individual Viewport. Since you can't use ENTMOD on a Viewport object, the only way (other than the command version) to modify it is with the ActiveX property "ArcSmoothness" of a PSViewport or Viewport object.

    Chuck Gabriel

    • Guest
    Silent Purge
    « Reply #24 on: June 28, 2005, 07:00:25 PM »
    Quote from: Jeff_M
    The first thing I tried was NOMUTT. Somehow, Purge overrides the NOMUTT setting and lists everything purged, or not, no matter what.


    Sorry for the bum steer.  I thought for sure it would work.

    Jeff_M

    • King Gator
    • Posts: 4093
    • C3D user & customizer
    Silent Purge
    « Reply #25 on: June 28, 2005, 08:25:08 PM »
    No problem, Chuck. I thought it would work, too, when I tested it. FYI, that's 2 things NOMUTT doesn't work with (at least in 2002): Purge and Dimstyle->Save

    David Hall

    • Automatic Duh Generator
    • King Gator
    • Posts: 4075
    Silent Purge
    « Reply #26 on: June 29, 2005, 11:09:02 AM »
    Not to throw in a huge monkey wrench, but VBA doesn't mutter.  Is it possible to use a vb app called from your lisp?
    Everyone has a photographic memory, Some just don't have film.
    They say money can't buy happiness, but it can buy Bacon and that's a close second.
    Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

    Jeff_M

    • King Gator
    • Posts: 4093
    • C3D user & customizer
    Silent Purge
    « Reply #27 on: June 29, 2005, 12:08:31 PM »
    Quote from: CmdrDuh
    ... but VBA doesn't mutter.
    Either does the lisp solution I posted for Randy.....  :D

    David Hall

    • Automatic Duh Generator
    • King Gator
    • Posts: 4075
    Silent Purge
    « Reply #28 on: June 29, 2005, 12:41:55 PM »
    sorry, i quickly scanned and didn't read the whole thread
    Everyone has a photographic memory, Some just don't have film.
    They say money can't buy happiness, but it can buy Bacon and that's a close second.
    Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)