Commit Graph

22765 Commits

Author SHA1 Message Date
Andrej730 24c4231013 build-all: do not deploy qt runtime
As it installs everything to `lib`, making it hard to filter things that are needed just for Python wrapper (e.g. skipping qt libs). Anyway we deploy everything ourselves manually in `package-zip-archives`.
2026-08-31 22:50:20 +05:00
Andrej730 8027bcf7da package-zip-archives: --no-zip 2026-08-31 22:50:20 +05:00
Andrej730 c4dde0b0c0 build-all: support providing ld library paths on Mac 2026-08-31 22:50:20 +05:00
Andrej730 8332371ed3 build-all: pass boost to ld library paths for tests 2026-08-31 22:50:20 +05:00
Andrej730 2d6e233bd0 build-all: reuse APPLE constant 2026-08-31 22:50:20 +05:00
Andrej730 da28d127d7 build-all: make BonsaiViewer a normal target, built by default
Can be skipped using `--without-BonsaiViewer` as any other target, if
needed.
2026-08-31 22:50:20 +05:00
Andrej730 d0119479a4 black, ruff 2026-08-31 22:50:20 +05:00
Petru Conduraru 481becfc05 ifcwrap: keep the derived marker when None is assigned to a derived attribute
set_attribute_value_py turned every Python None into blank{}, so
createIfcSIUnit(None, ...) stored a null in the derived Dimensions slot.
The STEP output still shows "*" and the Python accessor still resolves
the value, but validate() reads the raw slot and reports "Attribute is
derived in subtype" for every such instance. 0.8.5 accepted the same
call and kept the derived marker. Mirror populate_derived_() and store
derived{} when the target slot is derived.
2026-08-31 16:17:49 +02:00
Petru Conduraru 007cdce98c Bonsai: drop the last wrapped_data use, it is gone on v0.9.0
get_special_type_for_prop() reached the declaration through
entity.wrapped_data, which v0.9.0 removed when entity instances started
inheriting from the wrapper type directly. Ten ci-bonsai-daily tests
fail on it (quantification, pset editing, templated quantities). Use the
declaration property the way entity_instance.is_entity() itself does.
bonsai-0.9.0-alpha2608311411
2026-08-31 16:11:21 +02:00
dependabot[bot] b07b455304 build(deps): bump gersemi from 0.28.0 to 0.28.1
Bumps [gersemi](https://github.com/BlankSpruce/gersemi) from 0.28.0 to 0.28.1.
- [Release notes](https://github.com/BlankSpruce/gersemi/releases)
- [Changelog](https://github.com/BlankSpruce/gersemi/blob/master/CHANGELOG.md)
- [Commits](https://github.com/BlankSpruce/gersemi/compare/0.28.0...0.28.1)

---
updated-dependencies:
- dependency-name: gersemi
  dependency-version: 0.28.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-08-31 14:41:24 +05:00
Richard Brice 22b7f56ce4 Fixes clearing of cache when opening subsequent files bonsai-0.9.0-alpha2608301841 2026-08-30 10:49:08 -07:00
Richard Brice 5bbd5ea1b8 Fixes IfcSectionedSurface and IfcSectionedSolidHorizontal use of PBE.OffsetLateral and OffsetVertical by adding unit conversion factor. 2026-08-30 10:47:50 -07:00
Bruno Postle 15ab569e90 fuzz: adapt harness for v0.9.0 rebase
v0.9.0 already carries the ifcopenshell::file rename this harness was
originally adapted for, but moved Logger into the ifcopenshell namespace
too (logger::root() -> ifcopenshell::logger::root()) and never had a
BUILD_ONLY_COMMON_SCHEMAS cmake option - schema selection there has always
been via the SCHEMA_VERSIONS list. Verified with -fsyntax-only against the
system-installed v0.9.0 headers.
2026-08-30 14:41:02 +02:00
Bruno Postle 244b9ad23d fuzz: wire Logger output for single-input repro runs
Logger::SetOutput was never called by the harness, so every parse
warning/error (e.g. "Overwriting instance with name #N") was silently
discarded. This directly cost time root-causing a leak: grepping stdout
for an expected warning found nothing, looking like it ruled out a
hypothesis that was actually correct, because the message was just never
printed anywhere.

Only enable it when the binary is given an explicit file argument
(single-input repro, e.g. `-runs=1 <file>`), not during a real campaign
against a corpus directory, where logging on every execution would
dominate the runtime. Verified with -fsyntax-only against this branch's
headers (a real CMake build of ifcviewer-wgpu wasn't attempted, same as
the harness's prior namespace-rename commit).

Generated with the assistance of an AI coding tool.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-30 14:41:02 +02:00
Bruno Postle aab79ccff9 fuzz: update harness for ifcopenshell::file rename
ifcviewer-wgpu renamed IfcParse::IfcFile to ifcopenshell::file (header
moved to ifcparse/file.h) and Base::toString to Base::to_string. Update
the harness and README to match; verified with a syntax-only compile
against this branch's headers.
2026-08-30 14:41:02 +02:00
Bruno Postle 257b8a0dda fuzz: correct stale comment about lazy parsing in ifcparse fuzzer
Construction of IfcFile already tokenizes, type-checks, and resolves
every attribute of every instance, so toString() isn't what makes
tokenizer/argument bugs reachable.
2026-08-30 14:41:02 +02:00
Bruno Postle 92fc812a6b Add opt-in libFuzzer harness for IfcParse::IfcFile
A coverage-guided libFuzzer harness (src/ifcfuzz/ifcparse_fuzzer.cpp) that
constructs IfcFile directly from in-memory input and calls toString() on
every parsed instance to force full lazy attribute evaluation, rather than
only observing IfcConvert's exit code from a fuzzed subprocess.

Gated behind a new BUILD_FUZZERS option (OFF by default) so it has no
effect on existing builds; enabling it requires a Clang toolchain built
with -fsanitize=fuzzer. -fsanitize=fuzzer itself stays scoped to the one
new target rather than going into the global compiler flags, since it
supplies its own main() and would otherwise break every other target
including CMake's own compiler checks.

Already found and fixed three real bugs this way: two null-pointer
dereferences (in header parsing and reference resolution) and a leak of
IfcSpfLexer on early return/exception during file scanning.

See src/ifcfuzz/README.md for build and usage instructions.
2026-08-30 14:41:02 +02:00
Petru Conduraru 6f2e1aa993 fix(#6032): guard express::base::as<T>() on null instance 2026-08-30 11:36:19 +02:00
Petru Conduraru c80569ecc7 Ship the split shared libraries in the Python wheel 2026-08-30 11:32:35 +02:00
Thomas Krijnen 1a03fd7df1 Unify python versions across win and nix #9313 2026-08-29 13:34:01 +02:00
Vaibhav Srivastava 443bc0a5f8 docs: fix typo envrionment -> environment
Signed-off-by: Vaibhav Srivastava <vaibhavsri1712@gmail.com>
2026-08-29 13:31:15 +02:00
Bruno Postle 3bb8b0cb9a Support swig 4.5 (#9324)
Current swig has removed support for python2 macros, breaking the build.
See: https://github.com/swig/swig/blob/5872e9b4176cf59ce4e31b010c29a4cebf32960f/CHANGES#L391
2026-08-28 19:35:23 +01:00
Bruno Postle ff5e3b57cb Bump max python requirement to 3.15
The python bindings seem ok with python 3.15, which is near release.
2026-08-28 18:10:31 +01:00
Richard Brice 90d6d5f51a Add target-unit pickers to the Qto panels; keep unit symbols live bonsai-0.9.0-alpha2608281541 2026-08-28 08:41:11 -07:00
Richard Brice d11c4411ea Add dimensional-analysis fallback to get_project_unit() for IfcDerivedUnit 2026-08-28 08:41:10 -07:00
Richard Brice 2b7abcf2e6 Make quantity take-off respect manual Unit overrides; add target-unit support 2026-08-28 08:41:10 -07:00
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
Richard Brice d19c86c72a Add per-property/quantity Unit-override support to edit_pset/edit_qto, plus unit-scale and candidate-unit helpers
edit_pset()'s unpack_unit_value() couldn't distinguish "no Unit dict was
passed" from "{"Unit": None, ...} passed to explicitly clear an existing
override" -- both collapsed to a bare None, and every consuming call site
checked truthiness, so there was no way to actually clear a previously-set
property Unit override once one existed. Fixed with a private _NO_UNIT
sentinel; bare (unwrapped) values still leave Unit untouched exactly as
before.

edit_qto() had no Unit-handling capability at all: neither
update_existing_property() nor add_new_properties() ever read or wrote a
quantity's Unit attribute. Added the same {"Unit": ..., "NominalValue": ...}
wrapped-dict convention edit_pset() already supports, disambiguated from
the pre-existing IfcPhysicalComplexQuantity dict convention
({"Discrimination": ..., "HasQuantities": ...}) by checking for a "Unit"
key -- a complex-quantity spec never contains one.

ifcopenshell.util.unit gains two small helpers:
- get_unit_scale(unit): dispatches to get_derived_unit_scale/
  get_named_unit_scale depending on unit type, also used to de-duplicate
  calculate_unit_scale()'s own inline dispatch of the same logic.
- get_candidate_units(ifc_file, unit_type): all units in a file matching a
  given unit type, unlike get_project_unit()'s single-default lookup.

Adds regression tests for all of the above, including explicit-clear,
bare-value-preserves-override, and complex-quantity-routing-unaffected
cases.
2026-08-28 08:41:10 -07:00
Richard Brice d067cfd1b5 Show resolved unit symbols in read-only Pset/Qto view; add write-back and fallback regression tests
Previously, unit symbols only appeared while a Pset/Qto was in edit mode
(pencil icon) -- the read-only summary view read raw {name: value} dicts
straight from ifcopenshell.util.element.get_psets(), a completely separate
path from the Attribute/unit_symbol machinery, so it never showed a label
even after the earlier fixes. This matters for the "someone in the field
just looking at values" use case, not just editing.

- bim/module/pset/data.py: switch to get_psets(verbose=True) to get each
  property's own entity id, then resolve its unit symbol the same
  override-aware way the edit-mode path does (tool.Pset.get_unit_symbol_for_prop).
  Falls back gracefully (empty symbol) for IfcPreDefinedPropertySet
  attributes, which aren't IfcProperty entities and can't carry a Unit
  override.
- bim/module/pset/ui.py: read-only value button now shows "250 mm" instead
  of just "250".

Also adds the regression tests planned but not yet committed:
- test/tool/test_pset.py: edit a property with its own Unit override and
  write it back, confirming no rescale and the override survives.
- test/bim/test_prop.py (new): get_display_name() falls back to the plain
  name (no crash) when no unit is resolvable or the project has no units
  assigned at all.
2026-08-28 08:41:10 -07:00
Richard Brice 0e8d0ee845 Fix get_property_unit() crash on IfcPropertySingleValue.NominalValue = None
NominalValue is optional -- IfcPropertySingleValue permits a null value --
but get_property_unit() unconditionally accessed prop.NominalValue.is_a(),
crashing on any single-value property that's legitimately blank.

Also adds a regression test confirming IfcContextDependentUnit symbols
("each", "boxes", etc.) aren't shadowed by the IfcDerivedUnit branch added
in the previous commit.
2026-08-28 08:41:10 -07:00
Richard Brice 20a6c73fbf Add IfcDerivedUnit support to ifcopenshell.util.unit (scale, symbol, dimension identification) 2026-08-28 08:41:10 -07:00
Richard Brice 2bfcf8ab83 Fix calculate_unit_scale() crash on SQLite-linked files
IfcSIUnit.Dimensions is a schema-derived attribute that isn't computed for
Bonsai's SQLite-linked "large model" file representation, returning None
there instead of an IfcDimensionalExponents entity. #9278 added an
unconditional unit.Dimensions.LengthExponent access to every IfcSIUnit
processed by calculate_unit_scale(), so it crashed project loading for
any linked file, even ones with no unit prefixes at all -- not just the
prefixed-area/volume case the fix targeted.

Fixed by reading dimensions from the existing si_dimensions table (keyed
by the unit's stored Name, not the unresolvable derived attribute) instead
of unit.Dimensions.

See the PR discussion for a standalone reproduction script.
2026-08-28 08:41:10 -07:00
Richard Brice 4cfe1f96f8 Gets the pick list for bSDD properties with Allowed Values working 2026-08-28 08:41:10 -07:00
Andrej730 6dc14fa05c build-all: fix LIBRARY_EXT not considering macos
Led to error during OpenCOLLADA build:
```
2026-08-28 13:33:34,391 make[2]: *** No rule to make target `/Users/runner/work/IfcOpenShell/IfcOpenShell/build/Darwin/arm64/10.15/install/pcre-shared-8.41/lib/libpcre.so', needed by `lib/libOpenCOLLADABaseUtils.dylib'.  Stop.
2026-08-28 13:33:34,391 make[2]: *** Waiting for unfinished jobs....
```
2026-08-28 18:59:47 +05:00
Andrej730 12334d1f69 build-all: use kernel as gmp mirror
As it seems more stable than the other ones.
2026-08-28 18:59:47 +05:00
Andrej730 4e390acbbc build-all: fix missing cgal dependency on boost
boost does have `"boost" in targets` guard, so building just `cgal` previously would fail
2026-08-28 18:59:47 +05:00
Andrej730 1f6e02639b build_rocky: use dtolnay/rust-toolchain action 2026-08-28 18:59:47 +05:00
Andrej730 f3d1c62f57 build-all: set CMAKE_INSTALL_PREFIX automatically for all dependencies
The only tricky one was occt, but it seems `INSTALL_DIR` is always initialized with `CMAKE_INSTALL_PREFIX` if not provided, so it will work fine.
2026-08-28 18:59:47 +05:00
Andrej730 914720c7ac package-zip-archives: --shared flag
Currently adding `-shared-` suffix to all dependencies instead of overriding, to avoid mixups during transition period.
2026-08-28 18:59:47 +05:00
Andrej730 05152a5fc6 package-zip-archives: skip previously installed runtime deps 2026-08-28 18:59:47 +05:00
Andrej730 68da576123 build-all: provide LD_LIBRARY_PATH when testing wrapper import 2026-08-28 18:59:47 +05:00
Andrej730 05cc2d4e3d build-all: consider lib64 during examples testing 2026-08-28 18:59:47 +05:00
Andrej730 3a67602bd2 IfcParseExamples: fix gcc warning about not covered enum cases 2026-08-27 19:19:11 +05:00
Andrej730 2a9786bac2 package-zip-archives: --occt-shared
Packing OCCT shared libraries, seems to work. Though still got to do a test in CI before implementing `--shared`.
2026-08-27 18:48:58 +05:00
Andrej730 df31069743 package-zip-archives: target patching and checking more precisely
E.g. to ensure patching of qt libraries is not covering up issues with other runtime libraries.
2026-08-27 18:48:58 +05:00
Andrej730 48eddeec01 package-zip-archives: patch rpath for all runtime libs, not just qt
Unsure if it's required, but just to be safe and to avoid warnings showing up during `check_runtime_dependencies`.
2026-08-27 18:48:58 +05:00
Andrej730 453bf9b8e8 package-zip-archives: add libs to ignore during check_runtime_dependencies 2026-08-27 18:48:58 +05:00
Andrej730 705aacf659 package-zip-archives: check runtime deps for python wrapper too 2026-08-27 18:48:58 +05:00
Andrej730 94fa2dea42 package-zip-archives: make python wrapper packaging rerunnable
Now we have temporary staging area and each run works exactly the same, without affecting actuall installation.
2026-08-27 17:56:15 +05:00
Andrej730 57f0f89993 remove_tr1.patch: add a note 2026-08-27 17:07:35 +05:00