New Tool - Diagnose Invisibility - #3600
Conversation
There was a problem hiding this comment.
Nice tool — this is exactly the kind of "why can't I see this" pain that deserves automation, and the breadth of checks (workset, phase status via the real API, design option, filters via PassesFilter, section box in local coordinates, RCP-aware view range, etc.) is genuinely well thought out.
Two things worth a look before merge:
- The
visible_idsfast-path (viaFilteredElementCollector(doc, view.Id)) isn't a reliable "definitely visible" signal for crop-region/section-box clipping per Revit API docs — it can short-circuit past the dedicated crop/section-box checks and report "Visible" for elements that are actually clipped out. - The
pick_promptlocalized string (translated into 8 languages!) is never wired up torevit.pick_elements().
Neither is a showstopper, but the crop-box one directly affects report accuracy for a very common scenario.
Suggestions
| visible_ids = set( | ||
| get_elementid_value(e.Id) for e in query.get_all_elements_in_view(view) | ||
| ) | ||
| if eid in visible_ids: |
There was a problem hiding this comment.
FilteredElementCollector(doc, view.Id) is not a reliable "is actually visible" test for crop/section-box clipping. Per the Revit API docs remarks for the view-scoped collector constructor:
"For elements which are outside of a crop region, they may still be passed by the collector because Revit relies on later processing to eliminate the elements hidden by the crop... You can compare the boundary of the region with the element's boundary if more precise results are required."
So an element sitting entirely outside the crop region or an active 3D section box can still show up in visible_ids, causing this function to early-return [], [] ("Visible") here — before the dedicated crop-box/section-box checks (8a/8b) below ever run. Since "why isn't this outside my crop region visible" is a very common real-world case, this short-circuit can silently produce a wrong "Visible" verdict for exactly the scenario this tool is meant to diagnose.
Consider running the crop/section-box bbox checks even when the element is in visible_ids, or moving the fast-path check after those geometric checks.
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.
| selection = revit.get_selection() | ||
| if selection and len(selection) > 0: | ||
| return list(selection.elements) | ||
| elements = revit.pick_elements() |
There was a problem hiding this comment.
The pick_prompt string (translated into all 8 locales in the resource dictionaries) is never actually used — revit.pick_elements() is called with no message, so the status-bar prompt falls back to pyRevit's default instead of the localized "Select element(s) to diagnose".
| elements = revit.pick_elements() | |
| elements = revit.pick_elements(message=_t("pick_prompt", "Select element(s) to diagnose")) |
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.
There was a problem hiding this comment.
🔵 Needs a closer look
It is a large, self-contained new IronPython tool relying on many Revit visibility APIs that can only be validated by running inside Revit, which is beyond automated verification here.
Pull request overview
This PR adds a new pyRevit tool, Diagnose Invisibility, under Analysis.panel > Inspect.pulldown. Given one or more selected/picked elements and one or more chosen views, it prints a per-view, per-element report stating either that the element is visible or the specific reason(s) it is hidden. The diagnosis walks through every Revit mechanism that can hide an element (workset, phase filter, design option, category/subcategory, explicit hide, view filters, crop region, 3D section box, view range/clip planes, view template, view-specific ownership, and view discipline), reporting all applicable causes rather than stopping at the first. UI strings and hidden-reason messages are localized via sibling ResourceDictionary XAML files read through applocales.get_locale_string_from_xaml.
Changes:
- New
script.pyimplementing the visibility-diagnosis logic and the UI entry point (selection/pick → view selection → localized Markdown report with clickable links). - New
bundle.yamlwith localized title/tooltip for eight languages. - Eight
resources.ResourceDictionary.<locale>.xamlfiles providing localized UI strings and reason messages.
File summaries
| File | Description |
|---|---|
.../Diagnose Invisibility.pushbutton/script.py |
Core diagnosis logic and UI entry point; iterates checks and prints localized per-element reasons |
.../Diagnose Invisibility.pushbutton/bundle.yaml |
Button title/tooltip localized for 8 locales |
.../resources.ResourceDictionary.en_us.xaml |
English UI/reason strings (fallback locale) |
.../resources.ResourceDictionary.de_de.xaml |
German translations |
.../resources.ResourceDictionary.fr_fr.xaml |
French translations |
.../resources.ResourceDictionary.es_es.xaml |
Spanish translations |
.../resources.ResourceDictionary.pt_br.xaml |
Brazilian Portuguese translations |
.../resources.ResourceDictionary.ru.xaml |
Russian translations |
.../resources.ResourceDictionary.ko.xaml |
Korean translations |
.../resources.ResourceDictionary.chinese_s.xaml |
Simplified Chinese translations |
Review details
- Files reviewed: 10/10 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| selection = revit.get_selection() | ||
| if selection and len(selection) > 0: | ||
| return list(selection.elements) | ||
| elements = revit.pick_elements() |
Description
A new tool, Diagnose Invisibility, that explains why an element isn't
showing up in a view — instead of leaving you to click through Visibility
Graphics, worksets, filters, and view range by hand.
Select (or pick) one or more elements, pick one or more views, and it prints
a report per view listing, for every element, either "visible" or the exact
reason(s) it isn't.
Why
"Why can't I see this thing" is one of the most common Revit support
questions, and the answer is almost never just one setting. This walks
through every mechanism that can hide an element in a view, in order, and
reports every one that applies rather than stopping at the first hit.
Checks performed
PhaseStatus, not raw sequence numbers)discipline, e.g. certain structural/MEP-only or architectural-only
categories, independent of Visibility/Graphics)
Usage
to pick them.
in the model; each reason is spelled out in plain language.
Checklist
Before submitting your pull request, ensure the following requirements are met:
pipenv run black {source_file_or_directory}