Files
IfcOpenShell/src/bonsai/test/tool
Richard Brice 539066a58b Add UI to pick/override a property or quantity's unit of measure in the Pset/Qto editor
Bonsai's Pset/Qto editor could display a property or quantity's own Unit
override, but had no UI to author one -- only the project-level Project
Units panel existed, which sets defaults, not per-instance overrides.
Builds on the edit_pset/edit_qto Unit-wrapping support and the
get_unit_scale/get_candidate_units helpers added in the previous commit.

- bim/prop.py: Attribute gains unit_id (the STEP id of the property's own
  override, 0 = project default) and unit_id_enum (the dropdown-driving
  dynamic enum, "Default (<symbol>)" plus every candidate unit for the
  attribute's measure type). update_attribute_unit_id converts the stored
  value live when a different unit is picked, so the physical quantity is
  preserved rather than the number being silently relabeled.
- tool/pset.py: is_measurable_special_type/get_candidate_units_for_special_type/
  resolve_effective_unit/convert_attribute_unit support the picker and the
  live conversion. get_special_type_for_prop classifies a property by its
  value's own declared measure type, falling back to an explicitly-attached
  Unit for generic numeric types (e.g. IfcReal) whose spec carries no unit
  semantics of its own but which may still legitimately carry one. Seeding
  in import_pset_from_existing ignores a stray Unit attached to a property
  whose value has no numeric/measure semantics at all (e.g. text), which
  used to crash trying to select an identifier the picker's enum items
  never include.
- bim/module/pset/ui.py: the picker widget itself, next to the value field
  in edit mode, gated on the attribute being measurable.
- bim/module/pset/operator.py: EditPset wraps measurable values with their
  chosen Unit on save, for both properties and quantities. The qto
  rounding-loop fix reaches into the wrapped dict instead of assuming a
  bare float/int, which would otherwise zero out every unit-overridden
  quantity.

Adds regression tests across all of the above, including conversion
correctness, explicit-clear/default round-trips, an unrelated sibling
property's override surviving untouched, and the stray-Unit crash guard.
2026-08-28 08:41:10 -07:00
..
2024-08-13 23:09:50 +10:00
2026-01-26 17:13:18 +05:00
2026-01-26 17:13:18 +05:00
2026-01-26 17:13:18 +05:00
2026-07-22 19:01:49 +05:00
2025-07-28 19:27:59 +05:00
2026-01-26 17:13:18 +05:00
2026-01-26 17:13:18 +05:00
2026-01-26 17:13:18 +05:00
2026-01-26 17:13:18 +05:00
2026-01-26 17:13:18 +05:00
2026-03-11 18:38:24 +05:00
2026-01-26 17:13:18 +05:00
2026-01-26 17:13:18 +05:00
2026-01-26 17:13:18 +05:00
2026-01-26 17:13:18 +05:00
2026-01-26 17:13:18 +05:00
2026-01-26 17:13:18 +05:00
2026-01-26 17:13:18 +05:00
2026-01-26 17:13:18 +05:00
2026-01-28 21:49:13 +11:00