pyACAD panel

Reload

Rescan every extension folder and rebuild the pyACAD ribbon, without restarting AutoCAD.

On the ribbonButton, pyACAD panel
NeedsNothing
CommandPYRELOAD
ShortcutNone set (bind one in Shortcuts)

What it does#

Reads every extension folder again and rebuilds the pyACAD tabs from what it finds. New bundles appear, removed ones go, changed captions, tooltips, icons, keytips and shortcuts take effect, every tool's AutoCAD command is registered again, dock panels are rebuilt, and each extension's startup.py and app-init hook run again. Editing a tool and clicking Reload is the whole development loop. The command is PYRELOAD.

How to use it#

  1. Change something on disk: a new bundle folder, an edited bundle.yaml, a new icon, a file in pyacadlib.
  2. Click Reload. A toast says when the ribbon is rebuilt.
  3. Click your button. A script edit alone does not even need this: script.py is read fresh on every run.

Good to know / limits#

  • Two things need an AutoCAD restart instead: a changed engine path, and a *.lib folder added or removed (Reload says so in a toast). Edits to files already inside a *.lib folder are picked up.
  • Dock panels are rebuilt from scratch: the Layer Manager forgets its filter text and selection. The Ask AI conversation is kept.
  • Open pyACAD toasts close.
  • Only pyACAD's own tabs are rebuilt. Other add-ins are untouched.
  • If the ribbon is broken badly enough that this button is not there, type PYACADRELOAD: the loader defines it, so it exists even when no extension loaded.

Other uses#

  • Pick up an edit to the pyacad library itself: library modules stay cached between runs, and Reload is what refreshes them.
  • Reload writes ==== pyACAD reload ==== to %APPDATA%\pyACAD\logs\pyACAD.log, followed by every bundle it skipped and why, so a button that fails to appear is one log line away from an explanation.

Source#

The tool's own files, word for word as shipped in pyACAD.panel/Reload.pushbutton. Every pyACAD tool is an ordinary bundle: copy these into your own extension and change what you like.

script.py Runs on a click. View on GitHub
"""Rescan extension folders and rebuild the pyACAD ribbon (no restart needed)."""
from pyacad import toast

__pyacad__.Reload()
toast.success('pyACAD ribbon reloaded.')