Skip to content

[measure-tools] Flip condition for measurements in sheets - #1740

Open
Maxime-Brassard wants to merge 5 commits into
masterfrom
bugfix/invertDrawingTypes
Open

[measure-tools] Flip condition for measurements in sheets#1740
Maxime-Brassard wants to merge 5 commits into
masterfrom
bugfix/invertDrawingTypes

Conversation

@Maxime-Brassard

@Maxime-Brassard Maxime-Brassard commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

We flipped the conditions for sheet measurements in order to make them work on models where these details are not provided.
Before, we'd allow using the measurement only inside drawings that were in the allowedDrawingTypes list. Now, instead, we prevent using the measurement inside drawings in the forbiddenDrawingTypes list and allow everywhere else. That way, we're able to use the measurements when the data is not populated and still prevent using the measurements where it does not make sense.

@Maxime-Brassard
Maxime-Brassard marked this pull request as ready for review July 16, 2026 16:16
@Maxime-Brassard
Maxime-Brassard requested a review from simnorm as a code owner July 16, 2026 16:16
Copilot AI review requested due to automatic review settings July 16, 2026 16:16
@Maxime-Brassard
Maxime-Brassard enabled auto-merge (squash) July 16, 2026 16:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 updates sheet-measurement validity logic to be denylist-based instead of allowlist-based, enabling measurements to work when sheet drawing-type metadata is missing while still blocking nonsensical contexts (e.g., Detail drawings).

Changes:

  • Replace “allowed drawing types” checks with “forbidden drawing types” checks (tools now forbid Detail rather than only allowing a small set).
  • Update SheetMeasurementHelper tooltip and drawing-type gatekeeping helpers to match the new denylist semantics.
  • Adjust localized tooltip strings to say “cannot be used on …” and update list-joining wording accordingly.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/itwin/measure-tools/src/tools/MeasureLocationTool.ts Switches sheet validation to use forbiddenDrawingTypes + checkIfNotForbiddenDrawingType.
packages/itwin/measure-tools/src/tools/MeasureDistanceTool.ts Same denylist-based drawing-type gating for distance measurements.
packages/itwin/measure-tools/src/tools/MeasureAreaTool.ts Same denylist-based drawing-type gating for area measurements.
packages/itwin/measure-tools/src/api/SheetMeasurementHelper.ts Introduces checkIfNotForbiddenDrawingType and updates tooltip logic to match denylist semantics (also updates deprecated namespace).
packages/itwin/measure-tools/src/api/MeasurementTool.ts Renames base hook to forbiddenDrawingTypes and wires tooltip generation to it.
packages/itwin/measure-tools/public/locales/en/MeasureTools.json Updates tooltip strings to reflect denylist wording (“cannot be used”).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/measure-tools/src/api/SheetMeasurementHelper.ts
Comment thread packages/measure-tools/src/api/SheetMeasurementHelper.ts
Comment thread packages/measure-tools/src/api/MeasurementTool.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants