Commit Graph

20541 Commits

Author SHA1 Message Date
Bruno Perdigão 4ae34814e4 black formatting 2026-09-14 20:47:55 -03:00
Bruno Perdigão 5e522568e3 snap: remove face index from the GPU detection.
Now the face index can be handled only by the object raycast.
2026-09-14 20:47:55 -03:00
Bruno Perdigão 540c0fdc9d snap: avoid creating wireframe batches for solid objects 2026-09-14 20:47:55 -03:00
Bruno Perdigão e93858b8c6 snap: avoid unnecessary operations on each mouse mouse 2026-09-14 20:47:55 -03:00
Bruno Perdigão 6ef12a26f8 fix: add support to empty objects 2026-09-14 20:47:55 -03:00
Bruno Perdigão 626315a152 snap: fix wireframe snaps where there is no face occlusion 2026-09-14 20:47:55 -03:00
Bruno Perdigão 2328cc73d4 snap: use GPU detection for solid and wireframe objects.
Now is also works with x-ray mode.
2026-09-14 20:47:55 -03:00
Bruno Perdigão 50c1a0049c snap: remove custom edge BVH (SnapObj) 2026-09-14 20:47:55 -03:00
Bruno Perdigão d227f45663 snap: add snap dicts creation for GPU object detection 2026-09-14 20:47:55 -03:00
Bruno Perdigão 2912df5147 snap: add GPU object detection
Initial implementation of GPU object detection. It uses an offscreen
buffer with object ID enconded as colors, then reads the pixel(s) under
the cursor to find which object is hit.
It has two modes, one to detect faces and other the detect boundary edges and isolated vertices.
2026-09-14 20:47:55 -03:00
CyrilWaechter 243f0f32dc Handle null Styles when loading surface styles
An IfcSurfaceStyle with a NULL Styles set raised a TypeError when
loading a project. Guard the iterations, matching the existing
defensive pattern in import_presentation_styles.

Generated with the assistance of an AI coding tool.
2026-09-14 18:31:38 +02:00
Andrej730 32b408c3d5 check-whitespace: fix idempotency issue
See the comment, if there was couple whitespaces at the end of the file without newline, it would take running `check-whitespace` twice to finally fix it.
2026-09-14 17:23:21 +05:00
Andrej730 f3013f29df check-whitespace: normalize css files 2026-09-14 17:23:21 +05:00
Andrej730 3e88479277 check-whitespace: normalize json files 2026-09-14 17:23:21 +05:00
Andrej730 0c12d2334b check-whitespace: normalize javascript files 2026-09-14 17:23:21 +05:00
Andrej730 62259da3af bonsai/docs: drop duplicated dev_environment scripts
Scripts were outdated now, redirecting to general `dev_environment.py` instructions.
2026-09-14 17:23:21 +05:00
Dion Moult ec210a87db ifcparse: use std::filesystem in guess_file_type()
The stat()-based path helpers were added in 573e53ebf as a speculative
workaround for #7131 ("Ugly workarounds to not depend on
std::filesystem"). That issue turned out to be a hardcoded schema list
missing HEADER_SECTION_SCHEMA and was fixed separately.

Since the plug-in architecture landed, libIfcParse already depends on
std::filesystem: schema.h exports schema_plugin_directory() returning a
std::filesystem::path, and plugin.cpp uses it throughout. The build also
mandates C++17. The workaround therefore no longer avoids anything and
its comment is misleading.

Restore the std::filesystem version, using the error_code overloads so
inaccessible paths are still reported as "not there" rather than
throwing, and route the path through ifcopenshell::path::from_utf8 so
non-ASCII paths work on Windows, as file_reader.cpp already does.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WcUNL8YygRrNC5KpxELMHs
2026-09-14 09:18:14 +02:00
Andrej730 d5fd959e6c Add run-cmake.py, deprecate run-cmake.bat
Also drop-in replacement mostly, except extra cmake args need to be provided now after `--` - `python run-cmake.py vs2022-x64 -- -DGLTF_SUPPORT=ON`.

Internally, script relies on env variables much much less.
2026-09-11 19:12:01 +05:00
Andrej730 e7b33a909d cmake: remove CGAL_LIBRARY_DIR
It's an artifact from times when CGAL wasn't a header-only library.
2026-09-11 19:12:01 +05:00
Andrej730 51a86cdd86 Add install-/build-ifcopenshell.py, deprecate corresponding .bat files
Mainly drop-in replacement for `build-ifcopenshell.bat` with `--help`, kw args and args validation, but there's a small caveat.

Previously it was possible to pass args to the underlying build tool as simple positionals - e.g. `build-ifcopenshell vs2022-x64 Release /p:Foo=bar`.
This behaviour is disabled now, because it doesn't allow validating provided args - it's impossible to tell whether `--config Release` is meant to be passed to msbuild or was meant as `--build-cfg Release` for `build-ifcopenshell`.

But it's still possible to pass args to msbuild by using `--` - `python build-ifcopenshell.py vs2022-x64 Release -- /p:Foo=bar`

`install-ifcopenshell.py` is now just a small wrapper passing `--target INSTALL` arg.
2026-09-11 19:12:01 +05:00
Andrej730 8b571913ed api.h: format consistently for readibility 2026-09-11 19:12:01 +05:00
Thomas Krijnen 148ff02859 Fix to_string() on eof marker token (#9463)
* Rewrite to_string() to use switch{} and handle Token_NONE and identifier without as_string()

* Add regression tests for to_string() on tokens without a string form

Cover both halves of the recursion that made a whitespace-only file
segfault: token::to_string() on the EOF marker and on an instance name,
and a parse of input that lexes to zero tokens, which is how the header
parser reaches token::as_string() on the EOF marker.

Generated with the assistance of an AI coding tool.

---------

Co-authored-by: Bruno Postle <bruno@postle.net>
2026-09-10 11:02:00 +02:00
Dion Moult e1be433207 ifcparse: unregister a deleted instance's inverse records via its attributes (#9467)
process_deletion_inverse() called inverse_index::remove_source(), which
walked every record in the file's inverse index to find the ones whose
source is the deleted instance: O(R) per deletion, the dominant cost of
file.remove() on large files now that the lookup side no longer re-sorts.

The records a deleted instance contributed are exactly the entity
references in its own attributes, so walk those with the same visitor
build_inverses_() uses for registration and remove each record with a
targeted binary search instead. remove_source() has no callers left and
is deleted.

Also use the ordered view of batch_deletion_ids_ (a boost multi_index
that already had one) for the is-this-referencer-also-being-deleted
check in process_deletion_(), which was a linear std::find over the
sequenced view: O(b) per referencing instance made batch deletion of b
instances quadratic.

file.remove on 300 IfcPropertySet of a 155 MB IFC4 model (201k IfcRoot)
drops from 3.15 ms to 0.17 ms per call, batched removal of 2000 from
3.34 ms to 0.17 ms per call, root.remove_product on 100 walls from
332 ms to 131 ms per call.


Claude-Session: https://claude.ai/code/session_01HNrXDmR88wKPCYwGE21SyH
(cherry picked from commit 938442303f)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-09-10 08:04:58 +10:00
Bruno Postle 41390dad92 Accept an unquoted decimal in a selector value
Requiring quotes around a decimal was a surprise with no way to predict it:
Foobar.Baz>1 works, Foobar.Baz>1.5 is a syntax error, and > >= < <= are
almost always used on numbers. Writing Width>"0.2" also reads like a text
comparison even though it is not.

The "." is excluded from unquoted_string because it separates a pset from a
property, but that separator has already been consumed by the time a value is
read, so a number is unambiguous in value position. Add a decimal_string
alternative to the value rule only. Signed and leading dot forms are accepted,
1. is not, and pset, prop and query keys are unchanged - they still need
quoting for a ".".

The transformer returns the same string a quoted value would, so =1.5 and
="1.5" are the same query and compare() does the existing type coercion.
Nothing that parses today changes meaning; only inputs that used to be a
syntax error now work.

Update the quoting docs accordingly, and assert the Bay property that the
filter test set up but never checked.

Generated with the assistance of an AI coding tool.
2026-09-10 07:44:17 +10:00
Bruno Postle 1c6362ec31 Document the quoting rule in the selector syntax
An unquoted pset, prop, key or value may not contain any of , . = > < * !
or whitespace. This was never stated, and the only motivation the docs gave
for quoting was the "Level 3" example having a space, so there was nothing
to suggest that Pset_WallCommon.ThermalTransmittance=1.5 is a syntax error
while FireRating=2HR is fine. Decimal numbers are the common way to hit it.

State the rule where the reader meets values, in a new subsection under each
of the two value tables. The two grammars exclude different characters, so
the element value section states its own set and only the delta. Note that
all of these characters are a syntax error except the comma, which is read
as the filter separator instead, so Name=Foo,IfcWall silently means "named
Foo and an IfcWall" rather than matching the literal value.

Also fix the Query filter example, which had the same problem in the file
itself: query:types.count=0 does not error, it is silently parsed as a
property filter for a count property in a property set named query:types,
and matches nothing. Quote the keys, as the other query examples already do.

Generated with the assistance of an AI coding tool.
2026-09-10 07:44:17 +10:00
Dion Moult ba9810f459 [AI-generated, unverified] ifcparse: stop re-sorting the inverse index on every read after a write (#9460) 2026-09-10 07:31:45 +10:00
Andrej730 bfce5b9415 Introduce build-deps.py, deprecate build-deps.cmd
Moving to Python to make Windows build scripts more maintainable.

It's intended to be a drop-in replacement, so it should be possible to just switch `.\build-deps.cmd` to `python build-deps.py`, keeping exactly the same arguments and behaviour will be the same.
`build-deps.cmd` is deprecated, but not yet removed, but will be shortly after more testing.

Other batch files will be migrated to Python shortly after too.
2026-09-09 16:43:04 +05:00
Andrej730 b588d52ebe bonsai_deps: print executed commands 2026-09-09 16:43:04 +05:00
Andrej730 509b0f7f76 Fix ty disjoint-cast on geom/main.py
It was casting to `set`, while it's actually cannot be a set - both `include` and `exclude` can only be a list.
2026-09-09 16:43:04 +05:00
Andrej730 79fddd802e Fix ty warnings for using shutil.which on Windows
Apparently `ty` is being too strict here and warning about `Any` possibly being `PathLike` which is not supported on older Pythons.

```
error[deprecated]: The overload of `which` is deprecated
    --> src\bonsai\bonsai\bim\module\drawing\operator.py:2267:34
     |
2267 |                     command[0] = shutil.which(command[0]) or command[0]
     |                                  ^^^^^^^^^^^^ On Windows before Python 3.12, using a PathLike as `cmd` would always fail or return `None`.

error[deprecated]: The overload of `which` is deprecated
    --> src\bonsai\bonsai\tool\drawing.py:1324:30
     |
1324 |                 command[0] = shutil.which(command[0]) or command[0]
     |                              ^^^^^^^^^^^^ On Windows before Python 3.12, using a PathLike as `cmd` would always fail or return `None`.
```
2026-09-09 16:43:04 +05:00
Andrej730 71950f6b85 cmake/svgfill: drop undocumented USE_STATIC_MSVC_RUNTIME option
I've found this commit 4400a6e that was introducing this option to the main cmake, but I'm not sure if it ever was propagated to the main branch or was reverted inside one of the merges.

But anyway, `USE_STATIC_MSVC_RUNTIME` is currently used only in svgfill, not used in the main cmake and works out of sync with main cmake (it sets `Boost_USE_STATIC_RUNTIME` to `OFF` instead of guard+setting it to `ON`).

So removing this option and syncing the code.
2026-09-09 16:43:04 +05:00
Andrej730 20d56efdfc win: remove outdated msys2 scripts
They were very outdated and if we'll need msys2 support, we'll be able to introduce it later in our Python scripts.
2026-09-09 16:43:04 +05:00
Andrej730 dc69c19aa7 ifcopenshell-python: move mathutils related tests to Bonsai
Previously tests never ran since workflow targets 3.11 and running tests is gated by Python 3.13.
2026-09-04 13:26:05 +05:00
Andrej730 253448c32a geometry_creation.rst: shape_build doesnt' depend on mathutils 2026-09-04 13:26:05 +05:00
Andrej730 9bd9af6211 svgfill: fix gcc -Wcomment
Example:
```
src/svgfill/src/progress.h:2:1: warning: ‘/*’ within comment [-Wcomment]
```
2026-09-03 19:55:54 +05:00
Andrej730 e5f7981729 bonsaiviewer-autodesk: fix clippy 2026-09-03 19:55:54 +05:00
Andrej730 f6ca05e32c ifcgeom: remove commented out map_impl(IfcCompositeCurve)
It was specific to occt, now it's superseded by `map_impl` residing in the same file, but it's kernel-agnostic.
2026-09-03 19:55:54 +05:00
Andrej730 5529bc0ffe Remove occt kernel citation
It was an artifact from `src/ifcgeom_schema_agnostic/CITATION.cff`, we already have `src/ifcgeom/CITATION.cff` to cover this.
2026-09-03 19:55:54 +05:00
Andrej730 57a9e1e304 cmake: export document_serializer_rdb
There was an error building a standalone ifcwrap when previously built IfcOpenShell had rocksdb - `_ifcopenshell_wrapper.cpython-314-x86_64-linux-gnu.so: undefined symbol: _ZTV17RocksDbSerializer`.

`IFOPSH_WITH_ROCKSDB` propagated to the build, requiring rocksdb symbols, but `WITH_ROCKSDB` wasn't set and `document_serializer_rdb` target wasn't provided.
2026-09-03 19:55:54 +05:00
Andrej730 2db248e017 cmake/ifcwrap: skip insallation of .pyc files 2026-09-03 19:55:54 +05:00
Andrej730 d4fa8e4f62 cmake/ifcwrap: skip versioned .so files during source copy
E.g. files like `libTKBinTObj.so.7.8.1`. Same reasoning as for skipping other binaries.
2026-09-03 19:55:54 +05:00
Andrej730 ee12e36dcd cmake/ifcwrap: remove requirement for svgfill target
Since it's a plugin now and not linked directly.
`LIBSVGFILL` variable was set, but never used.
2026-09-03 19:55:54 +05:00
Andrej730 5aaf2107a5 test_package: xfail for current binary
It's missing pyodide build and we already allowed it, test will start failing on the next binary bump.
2026-09-02 20:08:33 +05:00
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