Skip to content

Refactor Section Box Tool to Support Configurable Toggle for Visibility or Active State#2797

Merged
jmcouffin merged 5 commits intopyrevitlabs:developfrom
Wurschdhaud:enhancement-for-section-box-toggle
Sep 8, 2025
Merged

Refactor Section Box Tool to Support Configurable Toggle for Visibility or Active State#2797
jmcouffin merged 5 commits intopyrevitlabs:developfrom
Wurschdhaud:enhancement-for-section-box-toggle

Conversation

@Wurschdhaud
Copy link
Copy Markdown
Contributor

Description

This PR refactors the existing Section Box toggle tool to support two distinct operational modes based on configuration:

  • Visibility mode: Toggles whether the section box is visible in the current 3D view.
  • Active state mode: Toggles whether the section box is active (enabled) in the current 3D view, with saved/restored bounding box geometry per view.

The tool now respects this configuration to perform either action (not both), depending on user preference.
In active mode, the section box bounding box is serialized safely using primitive data (due to .NET serialization limits in IronPython) and stored per-view for accurate restoration.

Tooltips have been updated in all supported languages (EN, DE, FR, RU) to reflect this new behavior and configuration-dependence. →generated by AI


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. → Revit 2024

Related Issues

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

  • Resolves #[issue number]

Additional Notes

  • Serialization handles BoundingBoxXYZ safely by extracting min/max points and transform components, avoiding direct .NET object pickling (which fails under IronPython).
  • Each 3D view has its own section box state saved independently.

Thank you for contributing to pyRevit! 🎉

Copy link
Copy Markdown
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 refactors the Section Box toggle tool to support configurable operation modes: visibility toggle vs active state toggle. The tool now saves/restores section box geometry per view in active mode, with proper serialization handling for .NET types in IronPython. Updated tooltips across multiple languages reflect the new configurable behavior.

Review Summary:

Found several critical bugs that need fixing before merge: consistent typos in configuration variable names that break functionality, logic issues allowing invalid configuration states, missing validation for mutually exclusive modes, resource management problems with file handles, and incomplete toggle operation in active mode. Review applied knowledge of pyRevit configuration patterns, IronPython resource management requirements, and tool validation standards.

Follow-up suggestions:

  • @devloai fix the identified issues
  • @devloai add validation to prevent invalid configuration states

Copy link
Copy Markdown
Contributor

@jmcouffin jmcouffin left a comment

Choose a reason for hiding this comment

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

Tested, works according to plan 2024-2026

@jmcouffin jmcouffin merged commit 54933e4 into pyrevitlabs:develop Sep 8, 2025
@jmcouffin
Copy link
Copy Markdown
Contributor

Thanks @Wurschdhaud

@jmcouffin jmcouffin added Tools Issues related to pyRevit commands [subsystem] Enhancement Enhancement request [class->Improved #{number}: {title}] labels Sep 8, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Sep 8, 2025

📦 New work-in-progress (wip) builds are available for 5.2.0.25251+0758-wip

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Sep 8, 2025

📦 New work-in-progress (wip) builds are available for 5.2.0.25251+0805-wip

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Sep 8, 2025

📦 New work-in-progress (wip) builds are available for 5.2.0.25251+0824-wip

@Wurschdhaud Wurschdhaud deleted the enhancement-for-section-box-toggle branch September 8, 2025 08:42
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Sep 9, 2025

📦 New work-in-progress (wip) builds are available for 5.2.0.25252+1659-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 5.2.0.25255+0644-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 5.2.0.25255+0911-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 5.2.0.25256+0727-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 5.2.0.25258+1448-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 5.2.0.25265+1047-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 5.2.0.25266+0803-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 5.2.0.25268+1757-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 5.2.0.25269+1336-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 5.2.0.25269+1431-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 5.2.0.25269+1436-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 5.2.0.25269+1822-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 5.2.0.25271+1719-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 5.2.0.25272+2003-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 5.2.0.25272+2012-wip

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Oct 7, 2025

📦 New work-in-progress (wip) builds are available for 5.2.0.25280+0218-wip

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Oct 7, 2025

📦 New work-in-progress (wip) builds are available for 5.2.0.25280+1054-wip

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Oct 7, 2025

📦 New work-in-progress (wip) builds are available for 5.2.0.25280+1057-wip

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Oct 9, 2025

📦 New work-in-progress (wip) builds are available for 5.2.0.25282+1656-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 5.2.0.25283+0140-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 5.2.0.25286+1022-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 5.2.0.25287+0905-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 5.2.0.25287+1000-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 5.2.0.25288+0613-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 5.2.0.25293+0755-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 5.2.0.25293+0828-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 5.2.0.25293+1113-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 5.2.0.25293+1234-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 5.2.0.25295+0707-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 5.2.0.25296+0824-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 5.2.0.25296+0837-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 5.2.0.25296+0923-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 5.2.0.25300+1037-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 5.2.0.25301+1412-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 5.2.0.25301+1521-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 5.2.0.25302+0921-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 5.2.0.25302+0949-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 5.2.0.25302+1503-wip

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Nov 3, 2025

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Nov 3, 2025

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

@github-actions
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

2 participants