Author Topic: remove blocks from recent list with lisp  (Read 3202 times)

0 Members and 1 Guest are viewing this topic.

PM

  • Guest
remove blocks from recent list with lisp
« on: August 10, 2020, 09:37:20 AM »
Hi i am using Autocad 2020 and i want to clean  the resent list of blocks in the block palette. To do this i have to delete manualy the blocks (one every time). Can any one helps me with a lisp code to do this faster?

Thanks

DEVITG

  • Bull Frog
  • Posts: 479
Re: remove blocks from recent list with lisp
« Reply #1 on: August 10, 2020, 11:15:28 AM »
You mean BLOCK's or Blockreference's?

Try it, will erase  all unreferenced BLOCK's


 
Code: [Select]
; Hecho por  Gabo CALOS DE VIT de CÓRDOBA ARGENTINA
;;;    Copyleft 1995-2020 por Gabriel Calos De Vit
;; DEVITG@GMAIL.COM

(DEFUN ERASE-BLOCK  (/
                     ACAD-OBJ
                     ADOC
                     BLOCK
                     BLOCK-COLL                               
                     MODEL                   
                     )
  (VL-LOAD-COM)
  (SETQ ACAD-OBJ (VLAX-GET-ACAD-OBJECT)) ;_ el programa ACAD
  (SETQ ADOC (VLA-GET-ACTIVEDOCUMENT ACAD-OBJ)) ;_ el DWG que esta abierto-
  (SETQ BLOCK-COLL (VLA-GET-BLOCKS ADOC))


  (VLAX-FOR BLOCK  BLOCK-COLL
    (IF (AND (NOT (WCMATCH (VLA-GET-NAME BLOCK) "*Space*"))
             (NOT (SSGET "_x" (LIST (CONS 0 "insert") (CONS 2 (VLA-GET-NAME BLOCK)))))
             ) ; and


      (VLA-DELETE BLOCK)


      ) ;if

    ) ; VLAX-FOR

  ); end defun







« Last Edit: August 10, 2020, 12:06:48 PM by DEVITG »
Location @ Córdoba Argentina Using ACAD 2019  at Window 10

ronjonp

  • Needs a day job
  • Posts: 7527
Re: remove blocks from recent list with lisp
« Reply #2 on: August 10, 2020, 11:22:32 AM »
Set BLOCKMRULIST to 0 to clear them.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

DEVITG

  • Bull Frog
  • Posts: 479
Re: remove blocks from recent list with lisp
« Reply #3 on: August 10, 2020, 12:08:14 PM »
Quote
Command:
Command: BLOCKMRULIST
Unknown command "BLOCKMRULIST".  Press F1 for help.
Location @ Córdoba Argentina Using ACAD 2019  at Window 10

ronjonp

  • Needs a day job
  • Posts: 7527
Re: remove blocks from recent list with lisp
« Reply #4 on: August 10, 2020, 12:22:44 PM »
Quote
Command:
Command: BLOCKMRULIST
Unknown command "BLOCKMRULIST".  Press F1 for help.
That variable was added to AutoCAD 2020.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

PM

  • Guest
Re: remove blocks from recent list with lisp
« Reply #5 on: August 10, 2020, 12:37:19 PM »
DEVITG  your lisp code dont work.

 ronjonp the BLOCKMRULIST just hide the recent blocks dont delete them. I want to delete them

Thanks

Crank

  • Water Moccasin
  • Posts: 1503
Re: remove blocks from recent list with lisp
« Reply #6 on: August 10, 2020, 01:41:48 PM »
It seems to be part of the AutoCAD profile, because I found the list in the Registry:
HKEY_CURRENT_USER > SOFTWARE > Autodesk > AutoCAD > R23.1 > ACAD-3001:409 >Profiles > [name of profile] > BlockContent > Recent'

So you can remove the items from the registry:
Code: [Select]
(defun c:NoRecentBlist ( / reg-key n)
(setq reg-key (strcat "HKEY_CURRENT_USER\\" (vlax-product-key) "\\Profiles\\" (getvar "CPROFILE") "\\BlockContent\\Recent"))
(foreach n (vl-registry-descendents reg-key T)
                (vl-registry-delete reg-key n)
)
        (princ)
)
But even if you delete keys, this will only take effect after you've restarted AutoCAD.
I guess another option would be to import a clean profile, but this will also be slow.
« Last Edit: August 23, 2020, 03:32:24 PM by Crank »
Vault Professional 2023     +     AEC Collection

ronjonp

  • Needs a day job
  • Posts: 7527
Re: remove blocks from recent list with lisp
« Reply #7 on: August 10, 2020, 02:34:34 PM »
DEVITG  your lisp code dont work.

 ronjonp the BLOCKMRULIST just hide the recent blocks dont delete them. I want to delete them

Thanks
Why do you need to delete them? That seems a bit sketchy.  :wink:

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

PM

  • Guest
Re: remove blocks from recent list with lisp
« Reply #8 on: August 12, 2020, 06:23:39 AM »
Why is  sketchy ? is not bad. I want to delete them because i don't use them

ronjonp

  • Needs a day job
  • Posts: 7527
Re: remove blocks from recent list with lisp
« Reply #9 on: August 12, 2020, 02:36:28 PM »
Why is  sketchy ? is not bad. I want to delete them because i don't use them
What if the code deletes something you want to use? Or something that someone else wants to use ( assuming you're on a network and have co-workers ).

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

PM

  • Guest
Re: remove blocks from recent list with lisp
« Reply #10 on: August 12, 2020, 03:29:05 PM »
nobady works on my pc. So i can delete anything i want  :2funny:

tombu

  • Bull Frog
  • Posts: 289
  • ByLayer=>Not0
Re: remove blocks from recent list with lisp
« Reply #11 on: August 13, 2020, 08:14:09 AM »
They're saved in folder RecentBlocks you can open with:
Code: [Select]
(progn(startapp "explorer" (strcat "/n,/e," (getvar "BLOCKSRECENTFOLDER")))(princ)) The block names in the folder are gibberish though it has a subfolder named .blocksMetadata with both a png image file you can recognize and a json file to correspond with each dwg in folder RecentBlocks.

That's as much as I've figured out so far.
Tom Beauford P.S.M.
Leon County FL Public Works - Windows 7 64 bit AutoCAD Civil 3D

tombu

  • Bull Frog
  • Posts: 289
  • ByLayer=>Not0
Re: remove blocks from recent list with lisp
« Reply #12 on: August 15, 2020, 09:08:26 AM »
The new 2021.1 release offers several new options to manage the blocks you see on the Recent tab. The first of those is the ability to clear individual blocks from the Recent tab. Just right-click on any block displayed on the Recent tab and choose “Remove From Recent List.” Easy peasy!

Of course, you may get to the point where, to eliminate clutter, you need to declare bankruptcy on the blocks shown on the Recent tab. If that is you, AutoCAD 2021.1 has you covered there too. Just right-click, and then choose “Clear Recent List.” Just like that, the Recent tab is cleared, and you have a blank space to start anew. https://thecadgeek.com/blog/autocad-2021-1-update/?utm_source=feedburner&utm_medium=email&utm_campaign=Feed%3A+TheCadGeekBlog+%28The+CAD+Geek+Blog%29
Release info: https://help.autodesk.com/view/ACD/2021/ENU/?guid=AUTOCAD_2021_UPDATES
Tom Beauford P.S.M.
Leon County FL Public Works - Windows 7 64 bit AutoCAD Civil 3D

PM

  • Guest
Re: remove blocks from recent list with lisp
« Reply #13 on: August 15, 2020, 10:08:57 AM »
Hi i have the same option in auocad 2020 but gives me the option to delete one block every time. If i have 20 or 30 blocks i need to do this 30 times.Thats why i ask for a lisp to dele all blocks