Copy Sheets to Open Documents: add “Preserve detail numbers” option (default ON), safer param handling, and richer logs#2754
Conversation
Add preserve detail number as an option. Make the script more robust. Add more details to the log.
There was a problem hiding this comment.
PR Summary:
This PR adds a "Preserve Detail Numbers" option (default ON) to the Copy Sheets to Open Documents tool, extending PR #2704. Key changes include:
• New checkbox option for preserving viewport detail numbers
• Enhanced error handling with try/except blocks around parameter operations
• Improved logging with per-viewport outcome messages
• Maintains backward compatibility with default behavior
Review Summary:
The PR successfully implements the requested feature with good intentions for safer parameter handling. However, the parameter access logic contains potential null reference vulnerabilities that could cause runtime failures. The review focused on defensive programming patterns required for robust Revit API parameter handling, drawing from repository standards around exception handling and API safety practices.
Follow-up suggestions:
• @devloai fix the identified parameter null reference issues
• @devloai consider adding unit tests to validate parameter handling edge cases
...vit.tab/Drawing Set.panel/Sheets.pulldown/Copy Sheets to Open Documents.pushbutton/script.py
Outdated
Show resolved
Hide resolved
...vit.tab/Drawing Set.panel/Sheets.pulldown/Copy Sheets to Open Documents.pushbutton/script.py
Outdated
Show resolved
Hide resolved
...vit.tab/Drawing Set.panel/Sheets.pulldown/Copy Sheets to Open Documents.pushbutton/script.py
Outdated
Show resolved
Hide resolved
czwangxtt
left a comment
There was a problem hiding this comment.
Fixed null check and exception handling.
...vit.tab/Drawing Set.panel/Sheets.pulldown/Copy Sheets to Open Documents.pushbutton/script.py
Outdated
Show resolved
Hide resolved
...vit.tab/Drawing Set.panel/Sheets.pulldown/Copy Sheets to Open Documents.pushbutton/script.py
Outdated
Show resolved
Hide resolved
...vit.tab/Drawing Set.panel/Sheets.pulldown/Copy Sheets to Open Documents.pushbutton/script.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the "Copy Sheets to Open Documents" tool by adding a configurable option for preserving viewport detail numbers during sheet copying operations. The enhancement provides users with flexibility to either preserve original detail numbers or allow Revit to assign new ones, while adding robust error handling and improved logging.
- Added a "Preserve Detail Numbers" checkbox option (defaulting to ON for backward compatibility)
- Implemented error handling with try/catch blocks to prevent script failures when parameters are unavailable
- Enhanced logging to provide detailed feedback on viewport processing outcomes
...vit.tab/Drawing Set.panel/Sheets.pulldown/Copy Sheets to Open Documents.pushbutton/script.py
Outdated
Show resolved
Hide resolved
...vit.tab/Drawing Set.panel/Sheets.pulldown/Copy Sheets to Open Documents.pushbutton/script.py
Outdated
Show resolved
Hide resolved
...vit.tab/Drawing Set.panel/Sheets.pulldown/Copy Sheets to Open Documents.pushbutton/script.py
Outdated
Show resolved
Hide resolved
…l/Sheets.pulldown/Copy Sheets to Open Documents.pushbutton/script.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…l/Sheets.pulldown/Copy Sheets to Open Documents.pushbutton/script.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…l/Sheets.pulldown/Copy Sheets to Open Documents.pushbutton/script.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25225+0806-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25225+1628-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25230+1701-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25232+0824-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25232+0848-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25232+0859-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25232+1126-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25232+1352-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25233+0639-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25233+1431-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25233+1438-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25237+0821-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25237+0841-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25237+1124-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25265+1047-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25266+0803-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25268+1757-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25269+1336-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25269+1431-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25269+1436-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25269+1822-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25271+1719-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25272+2003-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25272+2012-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25272+2017-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25272+2149-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25274+1734-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25277+1425-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25277+1427-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25279+2157-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25280+0218-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25280+1054-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25280+1057-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25282+1656-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25283+0140-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25286+1022-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25287+0905-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25287+1000-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25288+0613-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25293+0755-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25293+0828-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25293+1113-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25293+1234-wip |
|
📦 New work-in-progress (wip) builds are available for 5.2.0.25302+0949-wip |
Copy Sheets to Open Documents: add “Preserve detail numbers” option (default ON), safer param handling, and richer logs
Description
Extends PR #2704 by making preservation of viewport Detail Number optional. Default is ON to match current behavior. Adds
try/exceptguards to avoid script failure when the parameter is missing, and improves logging for transparency.Changes
try/exceptto prevent transaction rollback.Why
Checklist
Before submitting your pull request, ensure the following requirements are met:
pipenv run black {source_file_or_directory}Related Issues
Additional Notes