Author Topic: Silent Purge  (Read 6536 times)

0 Members and 1 Guest are viewing this topic.

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)