Author Topic: Purging Page setup...  (Read 9216 times)

0 Members and 1 Guest are viewing this topic.

ronjonp

  • Needs a day job
  • Posts: 7533
Purging Page setup...
« Reply #15 on: July 26, 2004, 12:14:41 PM »
Joel,

That would be great. Also deleting empty text entities and lines with 0 length would be nice. They can really add to file size.

Post here http://www.theswamp.org/lilly.pond/

Ron

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Andrew H

  • Guest
Purging Page setup...
« Reply #16 on: July 26, 2004, 12:16:17 PM »
Joel,

Any additional features for correcting drawings with one command/program are always welcome. Let us know when/where the new files are uploaded.

(a link would be nice)

Once again thank you for all the help.

Andrew H

  • Guest
Purging Page setup...
« Reply #17 on: July 26, 2004, 12:17:30 PM »
I agree with Ron Jonp.

M-dub

  • Guest
Purging Page setup...
« Reply #18 on: July 26, 2004, 12:38:03 PM »
Quote from: ronjonp
Also deleting empty text entities and lines with 0 length would be nice. They can really add to file size.


Code: [Select]
;; DelNul.lsp  
;; Deletes nul lines of Text, Mtext & Blocks.
;; Modified by JL Thomas 12/02/97  

(Defun C:DelNul ( / TXT BLK NB NAMES)
  (if(setq TXT (ssget "X" '((-4 . "<and")(-4 . "<or")
                           (0 . "MTEXT")(0 . "TEXT")
                           (-4 . "or>")(-4 . "<or")
                           (1 . "")(1 . " ")(1 . "  ")(1 . "   ")
                           (1 . "{}")(1 . "{ }")(1 . "{  }")(1 . "{   }")
                           (1 . "{}\P")(1 . "{ }\P")(1 . "{  }\P")(1 . "{   }\P")
                           (-4 . "or>")(-4 . "and>"))))
  (progn
    (command"_erase"TXT"")
    (princ(strcat"\n  "(itoa(sslength TXT))" nul text strings deleted. "))
   )
  (princ"\n  No nul text strings found. "))

  (setq BLK(tblnext"BLOCK"T)NAMES nil)
  (while BLK
    (if(=(cdr(assoc 0(entget(cdr(assoc -2 BLK)))))"ENDBLK")
    (progn
      (if(setq NB(ssget "X" (list(assoc 2 BLK))))
      (command"_erase"NB"")
       )
    (setq NAMES(cons(cdr(assoc 2 BLK))NAMES))
     )
   )
  (setq BLK(tblnext"BLOCK"))
  )
  (if NAMES
    (progn(textscr)
    (princ"\n  Nul blocks found and need purging: ")
    (foreach X NAMES(princ"\n    ")(princ X))
   )
  (princ"\n  No nul blocks found. ")
  )
(princ)
)
(c:DelNul)



If you're interested...

ronjonp

  • Needs a day job
  • Posts: 7533
Purging Page setup...
« Reply #19 on: July 26, 2004, 12:41:28 PM »
Thanks dub....I have that one as well, just thought it would be a good add-on for CDG Purge.

Here is my compilation of cleanup utils:

Code: [Select]
(defun c:ninja-lite (/ TXT NB NAMES BLK lay ent name removed cnt *acad* curdwg pslayout x)
 ;_____________________________________________________________________________
  ;; DELETES ALL LAYER FILTERS
 ;_____________________________________________________________________________

  (vl-Load-Com)
  (vl-Catch-All-Apply
    '(lambda ()
       (vla-Remove
(vla-GetExtensionDictionary
  (vla-Get-Layers
    (vla-Get-ActiveDocument
      (vlax-Get-Acad-Object)
    )
  )
)
"ACAD_LAYERFILTERS"
       )
     )
  )

 ;_____________________________________________________________________________  
  ;; DELETES NUL LINES OF TEXT, MTEXT, AND BLOCKS
 ;_____________________________________________________________________________

  (if (setq TXT (ssget "X"
      '((-4 . "<and")
(-4 . "<or")
(0 . "MTEXT")
(0 . "TEXT")
(-4 . "or>")
(-4 . "<or")
(1 . "")
(1 . " ")
(1 . "  ")
(1 . "   ")
(1 . "{}")
(1 . "{ }")
(1 . "{  }")
(1 . "{   }")
(1 . "{}\P")
(1 . "{ }\P")
(1 . "{  }\P")
(1 . "{   }\P")
(-4 . "or>")
(-4 . "and>")
)
)
      )
    (progn
      (command "_erase" TXT "")
      (princ (strcat "\n  "
    (itoa (sslength TXT))
    " nul text strings deleted. "
    )
      )
    )
    (princ "\n  No nul text strings found. ")
  )

  (setq BLK   (tblnext "BLOCK" T)
NAMES nil
  )
  (while BLK
    (if (= (cdr (assoc 0 (entget (cdr (assoc -2 BLK))))) "ENDBLK")
      (progn
(if (setq NB (ssget "X" (list (assoc 2 BLK))))
 (command "_erase" NB "")
)
(setq NAMES (cons (cdr (assoc 2 BLK)) NAMES))
      )
    )
    (setq BLK (tblnext "BLOCK"))
  )
  (if NAMES
    (progn (textscr)
  (princ "\n  Nul blocks found and need purging: ")
  (foreach X NAMES (princ "\n    ") (princ X))
    )
    (princ "\n  No nul blocks found. ")
  )
  (princ)
)

 ;_____________________________________________________________________________
;;CLEARS ALL LAYER STATES
 ;_____________________________________________________________________________

(
 (lambda (/ lay ent)
   (while (setq lay (tblnext "layer" (not lay)))
     (if (and
  (setq
    ent (entget (tblobjname "layer" (cdr (assoc 2 lay)))
'("RAK")
)
  )
  (assoc -3 ent)
)
       (entmod (subst '(-3 ("RAK")) (assoc -3 ent) ent))
     )
   )
 )
)

;_____________________________________________________________________________
;;DELETES REGISTERED APPLICATIONS EXCEPT FOR WID*
;____________________________________________________________________________
 
  (vl-load-com)
  (setq cnt 0)
  (if (not *acad*)
    (setq *acad* (vlax-get-acad-object))
  )
  (setq allapp (vla-get-registeredapplications
(vla-get-activedocument *acad*)
      )
  ) ;(setq name nil)
  (vlax-for app allapp
;(setq name (append name (list (vla-get-name app)))))
    (setq name (vla-get-name app))
    (cond ((or
    (not (wcmatch (strcase name) (strcase "WID*")))
  )
  (if
    (not
      (vl-catch-all-error-p
(vl-catch-all-apply
  'vla-delete
  (list app)
)
      )
    )
     (progn
(setq cnt (1+ cnt))
(setq removed
      (princ
(strcat
  "\nRemoved application \""
  name
  "\""
)
      )
)
     ) ;end progn
  )
  (if (not removed)
    (princ "\nNo applications were removable.")
    (print cnt)
  )
 )
    )
  )
  (princ)
  (setq name nil
removed nil
cnt nil
allapp nil
  )

;_____________________________________________________________________________
;;DELETES ALL PAGESETUPS
;_____________________________________________________________________________

(vl-load-com)
(setq
  curdwg   (vla-get-ActiveDocument (vlax-get-Acad-Object))
  pslayout (vla-get-Layout (vla-get-PaperSpace curdwg))
) ;_ end of setq
;; Call RefreshPlotDeviceInfo before GetPlotDeviceNames
(vla-RefreshPlotDeviceInfo pslayout)
(vlax-for x (vla-get-Plotconfigurations curdwg)
  (vla-delete x)
) ;_ end of vlax-for
(c:ninja-lite)



Ron

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Joel Roderick

  • Guest
Purging Page setup...
« Reply #20 on: July 27, 2004, 09:38:52 AM »
Thanks Mark....

Okay,
I have uploaded cdgpurge4.0 here:
http://theswamp.org/lilly.pond/roderick/cdgpurge40.zip

You will need to remove the path to cdgpurge3.0 from AutoCAD's search path and remove cdgpurge3.0 from the startup suite.

Then...

You will need to put all these files in a folder and then add that folder to AutoCAD's search path.  Then you can add cdgpurge40.fas to the startup suite.

Andrew H

  • Guest
Purging Page setup...
« Reply #21 on: July 27, 2004, 10:20:57 AM »
Thanks Joel, it works great. And I love the new option.

Code: [Select]
-cdgpurge
a



Here is a script file for the CDG Purge command with the "ALL" option. If you need additional options in the script, e-mail me and I'll be glad to help.

(e-mail link at the bottom of this post)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Purging Page setup...
« Reply #22 on: July 27, 2004, 10:56:35 AM »
Thanks Joel,
The command line start worked fine,
but the dcl gives me the following error "ObjectDCL file could not be loaded"
the arx file is in the search path.

CAB
I've reached the age where the happy hour is a nap. ()
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

pmvliet

  • Guest
Purging Page setup...
« Reply #23 on: August 05, 2004, 01:58:59 PM »
I'm with Cab, I can't get this to work.
I get an Object DCL error and then cannot find a certain file.
I placed all the files from the zip into the AutoCad 2002 support directory
which is in the search path...

Anyone got any ideas...

Andrew H

  • Guest
Purging Page setup...
« Reply #24 on: August 05, 2004, 02:03:17 PM »
JUST FYI...

ACAD 2005 has no problems with the files and CDG Purge 4.0 works great.

Andrew H

  • Guest
Purging Page setup...
« Reply #25 on: August 05, 2004, 05:47:05 PM »
Quote from: ronjonp
Joel,

That would be great. Also deleting empty text entities and lines with 0 length would be nice. They can really add to file size.

Post here http://www.theswamp.org/lilly.pond/

Ron


Ron,

Look into the "OVERKILL" express tools command (help file is part of the express tools help, not the regular acad help files).

andyanderson

  • Guest
Purging Page setup...
« Reply #26 on: August 05, 2004, 09:25:13 PM »
Try SuperPurge.  The freebie version has a nag screen the first time you use it on a drawing but it will, if required, take away your birthday!  i.e., use the "hard purge" option very carefully.

Another option is to reload AutoCAD after formatting your hard drive but I don't recommend it  :wink:

See http://www.manusoft.com/Software/SuperPurge/index.stm