FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Bonsai: sort drawing scale dropdown by scale ratio by theoryshaw · Pull Request #9357 · IfcOpenShell/IfcOpenShell · GitHub

Bonsai: sort drawing scale dropdown by scale ratio - #9357

Merged
theoryshaw merged 1 commit into
IfcOpenShell:v0.9.0from
theoryshaw:sort_diagram_scale_dropdown
Aug 25, 2026
Merged

Bonsai: sort drawing scale dropdown by scale ratio#9357
theoryshaw merged 1 commit into
IfcOpenShell:v0.9.0from
theoryshaw:sort_diagram_scale_dropdown

Conversation

Copy link
Copy Markdown
Member

Closes #9356.

The imperial scale list in get_diagram_scales() was stored as two consecutive blocks — architectural scales from 1'=1'-0" (1/1) down to 1/128"=1'-0" (1/1536), then engineering scales restarting at 1"=10' (1/120) and running to 1"=500' (1/6000) — so the dropdown descended, jumped back up, and descended again.

Both groups are now merged into a single sequence ordered by ratio, largest scale first, so e.g. 1"=10' (1/120) sits between 1/8"=1'-0" (1/96) and 3/32"=1'-0" (1/128). Same 31 entries, reordered only — no scales added or removed.

The metric list was already ordered by ratio and is unchanged.

Also fixes the secondary bug described in the issue: the enum cache was invalidated by comparing the cached list's length against hardcoded 13/31, but the imperial list has 32 entries, so the metric branch never fired and switching a scene from imperial back to metric kept showing imperial scales. It now records which unit system the cache was built for, which also won't go stale if entries are added later. purge() resets it alongside the list.

🤖 Generated with Claude Code

The imperial list ran the architectural scales from 1'=1'-0" down to
1/128"=1'-0", then restarted at 1"=10' for the engineering scales. Merge
both groups into a single sequence ordered by ratio, largest scale first.
The metric list was already ordered by ratio and is unchanged.

Also fix the enum cache invalidation, which compared the cached list's
length against hardcoded 13/31 while the imperial list has 32 entries, so
switching a scene from imperial back to metric kept showing imperial
scales. Track the unit system the cache was built for instead.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
theoryshaw merged commit 151aa2c into IfcOpenShell:v0.9.0 Aug 25, 2026
2 of 4 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

Drawing scale dropdown is not ordered by scale ratio in imperial units

1 participant


Back | FazBrowse Home | New Git URL