Extend “Rename Selected Sheets” to support true batch renaming modes#3389
Extend “Rename Selected Sheets” to support true batch renaming modes#3389Copilot wants to merge 6 commits into
Conversation
Agent-Logs-Url: https://github.com/pyrevitlabs/pyRevit/sessions/f44fc21e-ca6b-4130-989e-c907d4b17d84 Co-authored-by: jmcouffin <7872003+jmcouffin@users.noreply.github.com>
|
Unable to trigger custom agent "Code Reviewer". You have run out of credits 😔 |
There was a problem hiding this comment.
Pull request overview
This PR extends the pyRevitTools → Drawing Set → Sheets → “Rename Selected Sheets” command from simple case conversion into a true batch-renaming tool with multiple rename modes, preview/confirmation, and conflict/result reporting.
Changes:
- Added mode-driven batch rename operations: find/replace, prefix, suffix, uppercase, lowercase.
- Added precomputation of target names with preview + confirmation and categorized reporting (renamed/unchanged/conflicts/failed).
- Updated the
en_ustooltip text to reflect the expanded capabilities.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/Sheets.pulldown/Rename Selected Sheets.pushbutton/script.py |
Replaces the prior case-only renamer with mode-based batch renaming, preview, conflict checks, and 2-phase rename execution. |
extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/Sheets.pulldown/Rename Selected Sheets.pushbutton/bundle.yaml |
Updates the English tooltip to describe the new batch rename features. |
| unique_pairs = [] | ||
| for pair in valid_pairs: | ||
| name_taken = False | ||
| for sheet_id, sheet_name in all_sheet_names.items(): | ||
| if sheet_id in selected_sheet_ids: | ||
| continue | ||
| if sheet_name == pair['new_name']: | ||
| name_taken = True | ||
| break |
There was a problem hiding this comment.
Fixed in 7f286e7 — replaced the nested loop with a precomputed existing_names set built from all_sheet_names (excluding selected sheets), so the conflict check is now O(1) per candidate.
| if find_txt == '': | ||
| forms.alert('Find text can not be empty.') | ||
| return None |
There was a problem hiding this comment.
Fixed in 2c45e3a — changed all three instances of "can not" to "cannot" (lines 33, 53, 66).
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Agent-Logs-Url: https://github.com/pyrevitlabs/pyRevit/sessions/ff2babe9-505a-449a-b773-d1b0257326f4 Co-authored-by: jmcouffin <7872003+jmcouffin@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Agent-Logs-Url: https://github.com/pyrevitlabs/pyRevit/sessions/970b7536-efaa-4399-b7fd-0ef0c280a244 Co-authored-by: jmcouffin <7872003+jmcouffin@users.noreply.github.com>
Agent-Logs-Url: https://github.com/pyrevitlabs/pyRevit/sessions/a9656f4c-86f7-48af-8594-77e0691baf2c Co-authored-by: jmcouffin <7872003+jmcouffin@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.