Automatic Cache Clearing

Modified your P&ID or Plant 3D project configuration a lot? Plant products (AutoCAD Plant 3D and P&ID) will always cache project information locally. This speeds up performance when opening a project. However, if you modified the configuration, there will be some cases where a project will failed to be opened. So Plant producst comes with a utility called PnPLocalDataCachePurger which you can find inside the Program Files directory which helps with clearing that local cache files. 

I'm working in a large corporation with a lot of users, so there is always some people who complained why the software doesn't work (even it's so simple to clear the cache). So what's the best way to fix this permanently? That is having the software clear the cache automatically everytime it starts.

Solution

To do that, we'll take advantage how AutoCAD load lisp when starting up. Open notepad, paste the content below and save it as "acad.lsp".

(setq FSO (vlax-create-object "Scripting.FileSystemObject"))
(vlax-invoke FSO "DeleteFolder" (strcat (getenv "userprofile") "\\AppData\\Roaming\\Autodesk\\PnPPersistentCache") :vlax-true)
(vlax-release-object FSO)

Then place it inside one of these directory

  • C:\Program Files\Autodesk\AutoCAD 2014\PLNT3D
  • %APPDATA%\Autodesk\AutoCAD Plant 3D 2014\R19.1\enu\Support

So everytime you start AutoCAD Plant or P&ID, it will load the lisp file and delete %APPDATA%\Autodesk\PnPPersistentCache folder automatically.

Warning

  1. You might received warning when you place the lisp in APPDATA in 2014 version. Read more about TRUSTEDPATHS and SECURELOAD here
  2. This will impact the speed of opening a project because cache needs to be regenerated everytime you reopen AutoCAD. So use with care.

comments powered by Disqus