Commit Graph

22649 Commits

Author SHA1 Message Date
Andrej730 b6550c5aba bonsai/make: unpin brickschema
It was pinned in 84dcee6b3 due to the back-then-latest package being too big and alpha version was fixing it (also see https://github.com/IfcOpenShell/IfcOpenShell/issues/4368 )
`brickschema` is now 0.7.9, so the pin is no longer needed
2026-09-02 20:08:33 +05:00
Andrej730 c23972d440 test_brick: fix warnings from sqlalchemy
When fixing warnings, noticed that was working a bit inproperly - `bnode` always end up being an empty list (because there's no `brick, A, REF.IFCReference` triple), so then passing empty list to `triples` resulted in selecting all nodes isntead of just the expected `bnode` (that's the behaviour `sqlachemy` was sending the warnings about - when empty lists unexpectedly selected everything).
2026-09-02 20:08:33 +05:00
Andrej730 4eb093eefa typing: modernize Generator annotations
`None, None` assumed by default.
Though this was introduced in Python 3.13, before 3.13 it only breaks if we'd do `typing.Generator[T]` (which is deprecated) -`collections.abc.Generator[T]` works fine, it seems it never had an arity check.
2026-09-02 20:08:33 +05:00
Andrej730 261d2ce9a2 stub: get_attribute_category to consider derived attrs 2026-09-02 20:08:33 +05:00
Andrej730 1fa5eebf0c sql, stream: raise for accessing derived attributes
Raising `AttributeError` is definitely wasn't correct here, since it
might push the code to assume it's a wrong entity type. Returning some stub value like `None` also could suggest incorrect derived attribute
value, leading to unexpected behaviour. So adding an error, so it would
propagate and code would need to be adjusted not to rely on derived
attributes, if it actually interacts with sql/stream.

`test_unit` was asserting that derived attr will return `None`, though
it was actually raising `AttributeError`.
2026-09-02 20:08:33 +05:00
Andrej730 2b0ebcee32 sql: remove debug prints 2026-09-02 20:08:33 +05:00
Andrej730 6b62723aae typing 2026-09-02 20:08:33 +05:00
Andrej730 66126d21bc test_package: remove the requirement for intel Mac build 2026-09-02 20:08:33 +05:00
Andrej730 c2f39a70a3 gitignore: ignore all shared objects in ifcopenshell folder
Using symlinks just for main libs/pluigins doesn't seems to resolve `$ORIGIN` for some reason - e.g. occt libraries appears to be missing. So symlinking everything, including the dependencies seems to be the way to create a dev environment.
2026-09-02 20:08:33 +05:00
Andrej730 1f627690b6 bonsai dev-requirements: add brickschema, rdflib 2026-09-02 20:08:33 +05:00
Thomas Krijnen d11440af65 Address failing tests
* import-mode=import-lib to prevent temp rename

* Skip some failing tests

* Update stub

* Fix decorator
bonsai-0.9.0-alpha2609021356
2026-09-02 15:56:15 +02:00
Thomas Krijnen 99f1051d18 Run black 2026-09-02 13:48:31 +02:00
Petru Conduraru df3d07e952 fix(ifctester): accept tuple results when chaining facet filters
Facet.filter() implementations broad-phase query with
ifc_file.by_type(), then check isinstance(elements, list) to decide
whether a previous facet already narrowed the candidate set. In
v0.9.0, file.by_type() returns a tuple instead of a list, so that
check silently failed and every facet after the first re-scanned the
whole model instead of the already-narrowed (possibly empty) set.
This let a prohibited Entity+Attribute applicability match instances
of the wrong class, e.g. an IfcSlab satisfying an "IFCWALL" Entity
facet's chain. Accept tuples too, matching how by_type() results are
actually returned now.
bonsai-0.9.0-alpha2609021135
2026-09-02 13:36:14 +02:00
Petru Conduraru e7370dff9f fix(sql): recognise derived attributes in sqlite_entity.__getattr__
get_attribute_category() returns 3 for a derived attribute, but
sqlite_entity.__getattr__() only branched on FORWARD (1) and INVERSE
(2), so any derived attribute (e.g. IfcSIUnit.Dimensions) fell
through to the final AttributeError instead of returning None, which
is what SQLite-linked files are documented to do since derived
attributes are not computed for them. Mirrors the DERIVED handling
already present in entity_instance.py's __getattr__.
2026-09-02 13:35:51 +02:00
Petru Conduraru 040bebedfb fix(ifcdiff): resolve elements by GlobalId via by_guid, not by_id
diff() looked up common elements with self.old.by_id(global_id) /
self.new.by_id(global_id), passing a GlobalId string into a method
that expects a STEP integer id. On v0.8.0 file.by_id() was a Python
wrapper that transparently dispatched strings to by_guid(), so the
bug was silent. v0.9.0's file class binds by_id directly to the
C++ instance_by_id(int), so it now raises
TypeError: in method 'file_by_id', argument 2 of type 'int'.
2026-09-02 13:35:16 +02:00
DesertSpringsCivil 65ce0f71c4 win: collect underscore-prefixed runtime plugin DLLs in build artifacts
Runtime plugins are canonically named `ifcopenshell_<kind>_<name>` (decorated_basename() in src/plugin/plugin.cpp, and the OUTPUT_NAME properties of the plugin targets), but the archive collection filtered on the dotted `ifcopenshell.` prefix, which matches only the core shared libraries. Every load-by-name plugin was therefore silently dropped from every win64 / win-arm64 zip.

Accept both prefixes, and extend the geometry-writer exclusion to the underscore form so the per-schema writers keep their existing Python-package-only treatment.

Fixes #9301
2026-09-01 19:51:34 +02:00
Richard Brice 4374c81981 Honour IfcAxis2PlacementLinear Axis/RefDirection in the loft builder (#9408)
* Honour IfcAxis2PlacementLinear Axis/RefDirection in the loft builder

make_loft() (src/ifcgeom/infra_sweep_helper.cpp), shared by
IfcSectionedSolidHorizontal and IfcSectionedSurface, mishandled a cross
section's IfcAxis2PlacementLinear in two ways:

1. A placement carrying Axis but no RefDirection was placed with a fixed
   [e_y | e_z | e_x] world-axis permutation that ignored the directrix.
   On any directrix not running along +X (e.g. a north-south road
   pavement, or anywhere along a curve) the profile came out mis-oriented
   or collapsed to a sliver.

2. When two adjacent CrossSectionPositions used direction vectors
   inconsistently (a raked RefDirection at one, a plain Axis at the
   other) make_loft() logged GEO 42, dropped the rotation for the whole
   segment and squared every cap -- and in one configuration left the
   sweep frame flipped, so OpenCASCADE failed to build the solid at all.

Now a small profile_basis() helper builds every cross section's frame the
same way: profile Y = Axis, profile normal = RefDirection, and -- when
RefDirection is absent -- profile normal = the directrix tangent, so the
section stays perpendicular to the path (buildingSMART IFC4.x-IF #147).

When the two bracketing placements ask for the same orientation the sweep
frame carries it, built against the curve. When they disagree the sweep
frame stays on the shared Axis (continuous with the neighbouring
consistent segments, so nothing flips) and each end's own authored
orientation is folded into its profile points via a change of basis, so
each end cap still lands exactly as authored while the body in between
keeps following the directrix. The all-equal and no-direction-vector
paths are unchanged.

The two mappings now also carry the raw RefDirection through on
cross_section, alongside the existing rotation matrix.

Adds C++ tests (a raked end logs no GEO 42; a directrix that does not run
along +X still lofts a full-size solid) and Python tests (uniform prism
raked at one end and square at the other; a north-south directrix keeps
its width; OffsetLateral/OffsetVertical are scaled by the model length
unit).

* Renames profile_rotations to profile_axis for consistency with profile_ref_directions
bonsai-0.8.6-alpha2609011735
2026-09-01 10:35:11 -07:00
Petru Conduraru e4190a1636 ifcgeom: keep one copy of same-identity duplicate loops via set semantics
Adopt the reviewer's suggestion on #9396: instead of counting how many
skips each duplicate identity has earned, record which duplicate
identities have already built once. The first occurrence builds, the
rest are skipped. Distinct-identity loops that only become duplicates
after point mapping behave as before. Set semantics are also robust if
the helper is ever driven over the same shell twice, where a consumed
counter would under-build.
2026-09-01 19:32:59 +02:00
Petru Conduraru 1207338fa9 ifcgeom: keep one copy of repeated faces in faceset helper duplicate removal
Port of #8772 to v0.9.0 (open_cascade_kernel::faceset_helper is the
renamed class, same logic). When an IfcConnectedFaceSet repeats the
same IfcFace, wires() still dropped every occurrence via duplicates_,
leaving a hole in the shell; this counts the redundant occurrences
and skips only those, keeping one copy of each repeated face.
2026-09-01 19:32:59 +02:00
Petru Conduraru 66bcddc277 geom: expose a reusable kernel object to Python (prototype for #9417)
ifcopenshell.geom.create_shape constructs a geometry kernel, converter and
mapping on every call and discards them afterwards. For hybrid kernels the
construction alone rescans the plugin directory per component, which #9417
addresses on the C++ side by caching the resolved component ids. This
prototypes the alternative aothms suggested in the #9417 review: reuse the
constructed kernel itself from Python.

The wrapper gains a geometry_kernel class holding the converter (and through
it the kernel, mapping and conversion caches) built once per
(geometry_library, file, settings) triple, with create_shape(instance[,
representation]) delegating to the same helper the free create_shape uses,
now split so both paths share one body. Python gains
ifcopenshell.geom.kernel(settings, file, geometry_library) mirroring the
iterator constructor signature. The binding is fixed at construction:
settings are copied the way converter already copies them, and a guard
rejects instances from a different file because the mapping is file-bound.

On PGSuper_Import_Model.ifc (322 products, single-threaded, arm64 Linux),
hybrid-cgal-simple-opencascade drops from 71.97 ms/call with per-call
create_shape to 23.35 ms/call through the reused kernel, matching the
iterator (22.74 ms/call) without needing the #9417 cache; plain opencascade
is unaffected (23.30 vs 22.28 ms/call).
bonsai-0.9.0-alpha2609011726
2026-09-01 19:26:35 +02:00
Petru Conduraru e713fdb17e geom: cache hybrid kernel component resolution (#9371)
Constructing a hybrid kernel (e.g. hybrid-cgal-simple-opencascade) ran
find_kernel_match once per component on every construction. Each call
creates a plugin manager, walks the plugin search paths and loads every
geometry_kernel_* module from disk before matching the component name.
Named kernels only pay this once because they are registered in the
static registry after the first load, but a hybrid name is never
registered, so every iterator or create_shape construction repeated the
full scan (measured 28-100 ms per component on the reference model,
~70 ms extra per create_shape call; far worse on platforms where
library loading is expensive).

Cache the resolved component backend ids per hybrid name. The first
construction still performs the full discovery and registers the
matched modules; subsequent constructions build the components straight
from the registry without touching the disk.
2026-09-01 19:26:27 +02:00
Thomas Krijnen 4a81f72f32 Address quadratic inverse handling 2026-09-01 19:26:13 +02:00
Andrej730 5352d72815 build-all: use logger instead of print consistently ifcsverchok-0.9.0.260901 bonsai-0.9.0-alpha2609011313 2026-09-01 18:13:03 +05:00
Andrej730 2f7ab8852f build-all: document QT_DIR, QT6_VERSION variables 2026-09-01 18:13:03 +05:00
Andrej730 1477fd2bc0 build-all: use datetime instead of date executable 2026-09-01 18:13:03 +05:00
Andrej730 7c685942b2 build-all: use shutil and pathlib instead of mkdir and cp 2026-09-01 18:13:03 +05:00
Andrej730 ee0e67a63b build-all: use find_spec to check aqt 2026-09-01 18:13:03 +05:00
Andrej730 f462424185 build-all: clean up unused variables
`BOOST_VERSION_UNDERSCORE` unused since 2e35b07

`OCE_LOCATION` is dead since it was introduced 72d8b5377 (and was a dead variable in build-all.sh too)

`curl`, `wget` - replaced with `urlretrieve back in 51cf52c38

Moved `BOOST_LOCATION` next to its `build_dependency`, so it will have a harder time getting lost.
2026-09-01 18:13:03 +05:00
Andrej730 2afbb46eca package-zip-archives: --fail-on-missing-deps 2026-09-01 18:13:03 +05:00
Andrej730 1165a86317 pyproject: remove redundant "unused imports" comments
Since we refer to ruff rules by names
2026-09-01 18:13:03 +05:00
Andrej730 0606a6100c black, ruff 2026-09-01 18:13:03 +05:00
Richard Brice b5670c4fc5 Reverts from automatically adding stationing to alignments because of missing initial geometry. Adds support for stationing with decreasing values. bonsai-0.9.0-alpha2608312235 2026-08-31 15:34:47 -07:00
Ryan Schultz 971cccc186 Bonsai: fix comma-separated stylesheet paths only loading the last file (#9411)
Follow-up to cb08191. The comma-separated pset value was resolved by
tool.Ifc.resolve_uri() as a single path before add_stylesheet() split it,
so normpath collapsed the whole string down to the last entry.

Split the value into paths first, then resolve each one, and concatenate
the stylesheets in listed order into a single <style> element.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
bonsai-0.9.0-alpha2608312123
2026-08-31 16:22:59 -05:00
Andrej730 29e14c10cb build-all: --disable-icu on boost to avoid linking unexpected ICU libs
Example error coming from Linux build (`build_rocky` is bringing ISU dev libs transitively through pango/cairo):
```
./BonsaiViewer: error while loading shared libraries: libicudata.so.67: cannot open shared object file: No such file or directory
```
bonsai-0.9.0-alpha2608311750
2026-08-31 22:50:20 +05:00
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