Author Topic: Purging with ODBX?  (Read 5601 times)

0 Members and 1 Guest are viewing this topic.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Purging with ODBX?
« Reply #15 on: March 31, 2010, 09:16:15 PM »
Quasi pseudo code food for thought ...

Code: [Select]
([color=blue]defun [/color][color=red]_PurgeAxdbDocument[/color] ( axdbDocument / purgeableCollections initialCount thisCount lastCount flag )

    ([color=blue]setq [/color]
        purgeableCollections (_[color=red]GetPurgeAbleCollections [/color]axdbDocument)
        initialCount         ([color=blue]apply '+[/color] ([color=blue]mapcar [/color]'[color=red]_GetDeepCount [/color]purgeableCollections))
        thisCount            initialCount
        flag                 T
    )       

    ([color=blue]while [/color]flag [color=green];; do at least once[/color]
       
        ([color=blue]foreach [/color]collection purgeableCollections
       
            ([color=red]_RecursivelyKillItWithFire[/color] collection)
           
        )
       
        ([color=blue]setq [/color]
            lastCount thisCount
            thisCount ([color=blue]apply '+[/color] (mapcar '[color=red]_GetDeepCount[/color] purgeableCollections))
            flag      ([color=blue]/=[/color] lastCount thisCount)
        )
   
    )
   
    ([color=blue]princ [/color]([color=blue]strcat [/color][color=purple]"Purged "[/color] ([color=blue]itoa [/color]([color=blue]-[/color] initialCount thisCount)) [color=purple]" object(s).\n"[/color]))
   
    ([color=blue]princ[/color])
   
)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Purging with ODBX?
« Reply #16 on: April 01, 2010, 01:09:09 AM »
Not you too Michael.  Those color code post are horrible to read on Black22 theme.   :cry:
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Purging with ODBX?
« Reply #17 on: April 01, 2010, 01:14:13 AM »
For the benefit of the theme challenged:

Code: [Select]
(defun _PurgeAxdbDocument ( axdbDocument / purgeableCollections initialCount thisCount lastCount flag )

    (setq
        purgeableCollections (_GetPurgeAbleCollections axdbDocument)
        initialCount         (apply '+ (mapcar '_GetDeepCount purgeableCollections))
        thisCount            initialCount
        flag                 T
    )       

    (while flag ;; do at least once
       
        (foreach collection purgeableCollections
       
            (_RecursivelyKillItWithFire collection)
           
        )
       
        (setq
            lastCount thisCount
            thisCount (apply '+ (mapcar '_GetDeepCount purgeableCollections))
            flag      (/= lastCount thisCount)
        )
   
    )
   
    (princ (strcat "Purged " (itoa (- initialCount thisCount)) " object(s).\n"))
   
    (princ)
   
)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Purging with ODBX?
« Reply #18 on: April 01, 2010, 02:56:16 AM »
Quasi pseudo code food for thought ...

Code: [Select]
([color=blue]defun [/color][color=red]_PurgeAxdbDocument[/color] ( axdbDocument / purgeableCollections initialCount thisCount lastCount flag )

    ([color=blue]setq [/color]
        purgeableCollections (_[color=red]GetPurgeAbleCollections [/color]axdbDocument)
        initialCount         ([color=blue]apply '+[/color] ([color=blue]mapcar [/color]'[color=red]_GetDeepCount [/color]purgeableCollections))
        thisCount            initialCount
        flag                 T
    )       

 < .... >   
)
For the benefit of the theme challenged:
Code: [Select]
(defun _PurgeAxdbDocument ( axdbDocument / purgeableCollections initialCount thisCount lastCount flag )

    (setq
        purgeableCollections (_GetPurgeAbleCollections axdbDocument)
        initialCount         (apply '+ (mapcar '_GetDeepCount purgeableCollections))
        thisCount            initialCount
        flag                 T
    ) 
< .. >

Both read fine for me in the Mercury theme ....  :angel:

I can even read the code without re-formatting  :-D
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Purging with ODBX?
« Reply #19 on: April 01, 2010, 07:18:03 AM »
Perhaps this may help?

Maybe feed it this function  :-)

Code: [Select]
(Mac-ODBX '(lambda (x) (repeat 3 (vla-purgeall x)) (vla-save x)) nil)

{ Untested }