-
-
Notifications
You must be signed in to change notification settings - Fork 370
Door flip state #2663
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Door flip state #2663
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary:
This PR adds a new script for analyzing and updating door mirror states. It writes the mirror state (Left/Right) of doors to an instance parameter called 'Door Wing Opening Direction'. The script identifies mirrored vs. standard door configurations and updates a parameter that can be used for documentation or scheduling. It includes thorough error handling for doors without the required parameters and provides a detailed report of changes made.
Review Summary:
The code successfully implements the intended functionality but contains a few critical issues that should be addressed. The most significant concern is calling sys.exit()
within a transaction, which could leave the document in an inconsistent state. There are also some empty exception handlers that make debugging difficult, and a performance optimization opportunity with repeated parameter lookups. Feel free to provide feedback on this review for future improvements.
Follow-up suggestions:
@devloai fix the transaction handling to ensure the document remains in a consistent state
...Revit.tab/Analysis.panel/Tools.stack/Analyse.pulldown/Door Mirror State.pushbutton/script.py
Outdated
Show resolved
Hide resolved
...Revit.tab/Analysis.panel/Tools.stack/Analyse.pulldown/Door Mirror State.pushbutton/script.py
Outdated
Show resolved
Hide resolved
...Revit.tab/Analysis.panel/Tools.stack/Analyse.pulldown/Door Mirror State.pushbutton/script.py
Outdated
Show resolved
Hide resolved
...Revit.tab/Analysis.panel/Tools.stack/Analyse.pulldown/Door Mirror State.pushbutton/script.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a script that writes the mirror state of doors back to an instance parameter and updates the corresponding bundle metadata.
- Implements a new script (script.py) to update door mirror state via shared parameters.
- Updates the bundle.yaml with multilingual labels and tooltips for the pushbutton.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
script.py | Implements door mirror state update logic with shared parameter writebacks and summary reporting. |
bundle.yaml | Provides multilingual title, tooltip, and author metadata for the pushbutton. |
Comments suppressed due to low confidence (1)
extensions/pyRevitTools.extension/pyRevit.tab/Analysis.panel/Tools.stack/Analyse.pulldown/Door Mirror State.pushbutton/script.py:48
- [nitpick] The error message for a missing parameter is unclear. Consider rephrasing it to: "Please create the instance parameter 'Door Wing Opening Direction' with the option for different values for group instances in the Doors category."
Please create the parameter as an instance parameter, option different values for groupes,
...Revit.tab/Analysis.panel/Tools.stack/Analyse.pulldown/Door Mirror State.pushbutton/script.py
Outdated
Show resolved
Hide resolved
...vit.tab/Analysis.panel/Tools.stack/Analyse.pulldown/Door Mirror State.pushbutton/bundle.yaml
Outdated
Show resolved
Hide resolved
@mangrove-art Cool.
If you feel like sticking with the parameters approach, I suggest you use only project parameters and create them while in the script, and have a routine to delete them afterward. |
…ools.stack/Analyse.pulldown/Door Mirror State.pushbutton/script.py Co-authored-by: devloai[bot] <168258904+devloai[bot]@users.noreply.github.com>
- Black formatting - Removed unnecessary comments - Error Handling - pyrevit module usage instead of Autodesk's
…ools.stack/Analyse.pulldown/Door Mirror State.pushbutton/script.py Co-authored-by: Copilot <[email protected]>
…ools.stack/Analyse.pulldown/Door Mirror State.pushbutton/bundle.yaml Co-authored-by: Copilot <[email protected]>
Actually your thoughts are perfectly right although I cannot follow your advices. Let me explain.
|
Door flip state
Description
This script writes the mirror state (aka Left/Right) of doors back to an instance parameter 'Door Wing Opening Direction' in doors.
Checklist
Before submitting your pull request, ensure the following requirements are met:
Thank you for contributing to pyRevit! 🎉