Skip to content

Conversation

@Isaiah-Narvaez-42
Copy link
Contributor

Improved overall tool functionality

Description

This pull request enhances the ViewRange tool's user experience by improving interface:

Key Improvements:

  • Improved overall tool functionality and production readiness

Checklist

Before submitting your pull request, ensure the following requirements are met:

  • Code follows the PEP 8 style guide.
  • Code has been formatted with Black using the command:
    pipenv run black {source_file_or_directory}
  • Changes are tested and verified to work as expected.

Related Issues

If applicable, link the issues resolved by this pull request:


Additional Notes

User Impact:


Thank you for contributing to pyRevit! 🎉

Added offset and level change directly in UI
Copy link
Contributor

@devloai devloai bot left a 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 significantly enhances the ViewRange tool by adding the ability to modify view range planes. Key additions include:

  • New UI controls for editing offset values and selecting levels for each plane
  • Validation logic to ensure proper elevation ordering (Top ≥ Cut ≥ Bottom ≥ ViewDepth)
  • Support for "Unlimited" level settings
  • Apply and Reset button handlers for user modifications
  • Better view template detection and read-only state management

Review Summary:

Identified 4 critical bugs that need to be addressed before merge. The main issues involve state management in the singleton Context pattern, causing the "Reset" functionality to restore incorrect values when switching between views. Additionally, there are document reference bugs and IronPython-specific stale global state issues that violate established patterns per the review validation checklist.

The functionality design is solid with good validation logic, but the state persistence issues will cause confusing user experiences where reset doesn't work as expected after view changes.

Follow-up suggestions:

  • @devloai fix the identified state management and document reference issues
  • @devloai verify the XAML file has the necessary UI controls for the new functionality

@jmcouffin jmcouffin changed the title Improved overall tool functionality tool: Improved overall tool functionality - ViewRange Oct 16, 2025
@thumDer
Copy link
Contributor

thumDer commented Oct 23, 2025

I've just realized that his is related to #2866. Why are they 2 separate PRs?

@thumDer thumDer marked this pull request as draft October 23, 2025 12:37
@Isaiah-Narvaez-42
Copy link
Contributor Author

I've just realized that his is related to #2866. Why are they 2 separate PRs?

These should be together, this is my mistake

@Wurschdhaud
Copy link
Contributor

Not completely related, but since there is some refactoring going on:
it might make sense to add SelectionChangedEventArgs to pyrevitlib/pyrevit/revit/events.py and then use all the lib commands for event handling. Would probably clean up the code quite a bit.

jmcouffin and others added 3 commits October 29, 2025 10:40
…ggles3.stack/ViewRange.pushbutton/script.py

Co-authored-by: devloai[bot] <168258904+devloai[bot]@users.noreply.github.com>
…ggles3.stack/ViewRange.pushbutton/script.py

Co-authored-by: devloai[bot] <168258904+devloai[bot]@users.noreply.github.com>
@jmcouffin jmcouffin marked this pull request as ready for review October 29, 2025 09:44
@jmcouffin jmcouffin added Enhancement Enhancement request [class->Improved #{number}: {title}] Tools Issues related to pyRevit commands [subsystem] labels Oct 29, 2025
@Wurschdhaud
Copy link
Contributor

so I think with the #2888 you should be able to do sth like:

from pyrevit.revit import events

@events.handle("selection-changed")
def do_stuff():
      #does stuff in case of event

and at the end in your form closed thingi:

events.stop_events()

Isaiah-Narvaez-42 and others added 2 commits November 2, 2025 18:48
…UI with new layout and input fields for plane elevations and associated levels. Added functionality for applying changes and resetting values, along with warning messages for user feedback.
@jmcouffin
Copy link
Contributor

I've just realized that his is related to #2866. Why are they 2 separate PRs?

Ported the changes here, it is all yours to review if you like @thumDer

@jmcouffin
Copy link
Contributor

so I think with the #2888 you should be able to do sth like:

from pyrevit.revit import events

@events.handle("selection-changed")
def do_stuff():
      #does stuff in case of event

and at the end in your form closed thingi:

events.stop_events()

@Wurschdhaud You may want to help and make it happen here.
I am trying to wrap up this PR and the import export excel one to be able to make the new release. I would appreciate if you can help.

… Increased width of UI elements for better layout, added text wrapping for headers, and improved event management by replacing manual subscription with decorators. Enhanced document reference handling to ensure valid view context.
@Wurschdhaud
Copy link
Contributor

Wurschdhaud commented Nov 3, 2025

I saw you already added it @jmcouffin ?

Skimming through i noticed:

  • The imports need to be cleaned up/deleted:
image
  • and i think this:
    from __future__ import print_function
    is not needed as well

  • There are quite a view .IntegerValue which will prevent it from running in Revit 2026, the usual pyrevit.compat should fix that.

image
  • unused variables:
image image

I just played a round with it for a bit, didn't run into any issues.
I'd fix it myself real quick, but I have no idea how to commit onto a foreign PR

@jmcouffin
Copy link
Contributor

@Wurschdhaud usually, a basic checkout, commit to the PR branch is allowed. Give it a try.

@jmcouffin
Copy link
Contributor

@Wurschdhaud I'm on it

…anization. Replaced direct access to IntegerValue with a utility function for better compatibility. Updated PLANES definition to use OrderedDict for consistent ordering. Cleaned up unused imports and improved document reference handling.
@jmcouffin
Copy link
Contributor

Ok, good enough for tonight!
Thank you all

@jmcouffin jmcouffin merged commit dac1f8e into pyrevitlabs:develop Nov 3, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 2025

📦 New work-in-progress (wip) builds are available for 5.2.0.25307+2011-wip

@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 2025

📦 New work-in-progress (wip) builds are available for 5.2.0.25307+2045-wip

@thumDer
Copy link
Contributor

thumDer commented Nov 3, 2025

additional fix in #2900

@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 2025

📦 New work-in-progress (wip) builds are available for 5.3.0.25307+2237-wip

@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2025

📦 New work-in-progress (wip) builds are available for 5.3.0.25308+0721-wip

@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2025

📦 New public release are available for 5.3.0.25307+2146

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement Enhancement request [class->Improved #{number}: {title}] Tools Issues related to pyRevit commands [subsystem]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants