Skip to content

Conversation

@Isaiah-Narvaez-42
Copy link
Contributor

Refactor View Range window layout and bindings

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! 🎉

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 transforms the ViewRange tool from a read-only visualization window into an interactive editor. The XAML refactor introduces:

  • Editable TextBox inputs for modifying view range plane offsets
  • ComboBox controls for selecting associated levels
  • Action buttons (Apply Changes, Reset to Original)
  • Enhanced layout with column headers and warning message display

Review Summary:

Review identified 3 critical/high severity issues that prevent this PR from functioning. The most critical issue is that the XAML introduces extensive new data bindings and event handlers that have no corresponding Python backend implementation in script.py. Additionally, the refactor introduces a bug that hardcodes units to "feet" (breaking the existing dynamic unit support), and uses an incorrect property path for ComboBox level selection that will fail in IronPython with Revit API objects.

The review leveraged knowledge of pyRevit's WPF forms architecture, IronPython 2.7 constraints, and Revit API patterns to validate the XAML bindings against the Python backend.

Follow-up suggestions:

  • @devloai check if there's a related PR with the script.py implementation
  • @devloai create a complete implementation with both XAML and Python backend changes

<TextBlock Grid.Row="1" Grid.Column="1" Text="Top Plane" VerticalAlignment="Center" Margin="5,0"/>
<TextBlock Grid.Row="1" Grid.Column="2" Text="{Binding topplane_elevation}" VerticalAlignment="Center" Margin="5,0"/>
<TextBox Grid.Row="1" Grid.Column="3" x:Name="topplane_input"
Text="{Binding topplane_new_value, UpdateSourceTrigger=PropertyChanged}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing Python backend implementation for all new bindings and functionality

The XAML introduces multiple new data bindings that have no corresponding implementation in script.py:

Missing reactive properties in MainViewModel:

  • topplane_new_value, cutplane_new_value, bottomplane_new_value, viewdepth_new_value
  • topplane_level_id, bottomplane_level_id, viewdepth_level_id
  • available_levels, cutplane_level_name
  • can_modify_view, warning_message

Missing event handlers in MainWindow:

  • apply_changes_click (line 100)
  • reset_values_click (line 102)

Missing business logic:

  • Level collection and filtering
  • Offset calculation and validation
  • Transaction handling for applying changes
  • Error handling and validation messages

This PR cannot function as-is and will cause runtime binding errors when the window loads. The Python backend implementation needs to be included for this refactor to be complete.

Action required: Either:

  1. Include the complete script.py changes in this PR, or
  2. If this is part of a multi-PR implementation, mark it as draft and link to the related PRs
actions

Feedback: Rate this comment to help me improve future code reviews:

  • 👍 Good - Helpful and accurate
  • 👎 Poor - Wrong, unclear, or unhelpful
  • Skip if you don't have any strong opinions either way.

@jmcouffin jmcouffin changed the title Refactor View Range window layout and bindings refactor: View Range window layout and bindings Oct 16, 2025
@thumDer thumDer self-assigned this Oct 18, 2025
@thumDer thumDer marked this pull request as draft October 18, 2025 14:10
jmcouffin and others added 3 commits October 29, 2025 10:48
…ggles3.stack/ViewRange.pushbutton/MainWindow.xaml

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

Co-authored-by: devloai[bot] <168258904+devloai[bot]@users.noreply.github.com>
@jmcouffin jmcouffin added Enhancement Enhancement request [class->Improved #{number}: {title}] Tools Issues related to pyRevit commands [subsystem] labels Oct 29, 2025
@Isaiah-Narvaez-42 Isaiah-Narvaez-42 marked this pull request as ready for review November 2, 2025 23:49
jmcouffin added a commit to Isaiah-Narvaez-42/pyRevit that referenced this pull request Nov 3, 2025
…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 jmcouffin closed this Nov 3, 2025
@jmcouffin
Copy link
Contributor

ported changes in #2865

@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

@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.

3 participants