Commit Graph

20118 Commits

Author SHA1 Message Date
Thomas Krijnen 4e49b640a7 Own iterator geometry results
Return independent geometry copies with unique ownership, preserve parent lifetimes, and teach the Python wrapper to own derived results. Keep serializer inputs non-owning and replace Collada's deferred object with copied triangulation elements.\n\nGenerated with the assistance of an AI coding tool.
2026-08-08 15:18:51 +02:00
Thomas Krijnen c30841aad6 Remove unused adaptor element path
The optional adaptor element list was never assigned, so simplify IfcConvert to use its geometry iterator unconditionally.

Generated with the assistance of an AI coding tool.
2026-08-08 15:00:48 +02:00
Thomas Krijnen 4597929df9 Remove _t suffixes from public types
Rename header-scope aliases, enums, and helper types while retaining descriptive names where dropping the suffix would create a collision.

Generated with the assistance of an AI coding tool.
2026-08-08 14:58:26 +02:00
Thomas Krijnen 2859c1ef17 Use value serialization in sphere example
Update the stale pointer-form example and pass the IFC file required by the current serialization API.

Generated with the assistance of an AI coding tool.
2026-08-08 14:21:10 +02:00
Thomas Krijnen 7ae6bf4374 Rename geometry and serializer files
Apply the rename manifest, normalize serializer filenames to the classes they define, and update includes and CMake source lists.

Generated with the assistance of an AI coding tool.
2026-08-08 14:20:05 +02:00
Thomas Krijnen 02481b3247 Wrap more classes into ifcopenshell:: namespace 2026-08-08 13:58:39 +02:00
Thomas Krijnen 2c47c9d4fa Irrelevant comment 2026-08-08 13:30:47 +02:00
Thomas Krijnen c2abc3f844 Remove old Java Native Interface code 2026-08-08 13:29:29 +02:00
Thomas Krijnen 4dcd644a32 Deleted unmigrated examples 2026-08-08 13:10:01 +02:00
Thomas Krijnen 6fea72b045 Run black 2026-08-08 12:42:25 +02:00
Thomas Krijnen 1573730f18 Disambiguate naming 2026-08-08 12:35:44 +02:00
Thomas Krijnen af58eaf79f Last minute refactoring 2026-08-08 07:42:45 +02:00
Thomas Krijnen 8870ffb018 Rework c++ docs 2026-08-08 03:44:56 +02:00
Andrej730 4d0e5f6aee ifcopenshell.file: improve missing attribute error msg 2026-08-07 17:53:18 +05:00
Andrej730 dfc60196ec ifcwrap/cmake: fix using python:abc feature on older swig 2026-08-07 16:00:33 +05:00
Andrej730 ef4bba8b33 IfcGeomWrapper: remove stale IfcGeom::Matrix reference
It was removed long time ago in c78b289
2026-08-07 16:00:33 +05:00
Andrej730 253918c100 serialization/cmake: remove dependency on geometry_kernel_opencascade
To fix wrapper depending on `ifcopenshell.geometry.kernel.opencascade.so` plugin, which breaks wasm module import (wrapper imported first and it fails because occt kernel isn't loaded yet and loading kernel first since it needs some symbols from the wrapper).

`geometry_serializer` seems to need `OpenCascadeConversionResult.h` from the kernel just to be able to refer to structs (`ConversionResultShape`, `OpenCascadeShape`) and include with relative path already allows it.
2026-08-06 19:49:54 +05:00
Andrej730 c57554a07e ifcwrap/cmake: dont link against geom kernels
Produces errors in wasm builds - we want to be able to load the wrapper first and all other dependencies should be pluggable. But loading wrapper first failed, because it depended on the kernels. Loading kernels first would also fail, since OCCT kernel is using using some symbols from core (`ifcopenshell::exception`) and in wasm they have to be resolved all during `dlopen`.
2026-08-06 19:49:54 +05:00
Andrej730 2aff2adb42 gitattributes: normalize .i swig templates line endings
IfcGeomWrapper.i was stored on index as CRLF and on Linux it sometimes produced distracting diffs, when working on the file.
2026-08-06 19:49:54 +05:00
Andrej730 027203008d black . 2026-08-06 19:11:27 +05:00
Dion Moult 74b405a9f7 Write GlobalId index when serializing to RocksDB
rocks_db_file_storage already exposes a `g|`-prefixed guid -> instance
name map, but RocksDbSerializer never populated it, so by_guid() on a
converted file always threw.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-06 10:20:03 +10:00
Dion Moult 38e0e0e297 Compare entity instances in one file by identity again
entity_instance.file is a property backed by a fresh SWIG wrapper on every
access, and ifcopenshell::file had no __eq__, so `self.file != other.file`
in entity_instance.__eq__ compared two throwaway wrappers and was always
true - even for an instance against itself. Every entity comparison
therefore took the deep get_info() branch, making distinct but structurally
identical instances compare equal and leaving the final `return False`
unreachable. Bonsai's TestAddRepresentationItemToShapeAspect showed this as
two separate IfcShapeAspects being treated as one, so the stale aspect was
never removed.

Restore the file_pointer() pair that was commented out on both
ifcopenshell::file and express::Base - IfcParseWrapper.i already described
it as the way to "trace file ownership of instances on the python side" -
and give file the __eq__/__hash__ it was missing. The express::Base one
needs $self->file() now that file_ lives on instance_data. This also
repairs rocksdb_lazy_instance.__eq__, which already called file_pointer().

EXPRESS `=` is value comparison and `:=:` is instance comparison, but
rule_compiler emits `==` for both (see the @todo on process_rel_op), and
derived attributes build their operands in the shared global file, so rules
compare same-file instances and need value semantics. Restore those for the
duration of rule execution with settings.compare_instances_by_value,
alongside the existing unpack_non_aggregate_inverses.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-06 10:20:03 +10:00
Andrej730 3340d88b95 ifcwrap/cmake: add missing geometry_serializer runtime target installation
Caused errors like so:
```
Traceback (most recent call last):
  File "/__w/IfcOpenShell/IfcOpenShell/build/Linux/x86_64/install/python-3.13.6/lib/python3.13/site-packages/ifcopenshell/__init__.py", line 87, in <module>
    from . import ifcopenshell_wrapper
  File "/__w/IfcOpenShell/IfcOpenShell/build/Linux/x86_64/install/python-3.13.6/lib/python3.13/site-packages/ifcopenshell/ifcopenshell_wrapper.py", line 10, in <module>
    from . import _ifcopenshell_wrapper
ImportError: libifcopenshell.geometry.writer.so: cannot open shared object file: No such file or directory
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
    import inspect, ifcopenshell; print(inspect.getfile(ifcopenshell))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/__w/IfcOpenShell/IfcOpenShell/build/Linux/x86_64/install/python-3.13.6/lib/python3.13/site-packages/ifcopenshell/__init__.py", line 89, in <module>
    raise ImportError("IfcOpenShell not built for '%s' (%s)" % (python_distribution, e)) from e
ImportError: IfcOpenShell not built for 'linux/64bit/python3.13' (libifcopenshell.geometry.writer.so: cannot open shared object file: No such file or directory)
```
2026-08-04 22:10:31 +05:00
Andrej730 108acf1cd0 build_rocky: rely on uv for providing Python 2026-08-04 14:24:32 +05:00
Andrej730 cf7a484ce1 black . 2026-08-04 14:24:32 +05:00
Dion Moult 6aeaba0e3d p62ifc: carry across what the P6 export actually says
Level of Effort activities were skipped outright. They are now imported as
IfcTask with PredefinedType ATTENDANCE, the nearest thing IFC has to support
work that spans what it hangs off. Their dates stay derivable: the SS/FS and FF
predecessors P6 computes the span from are ordinary relationships and are
written out like any other. Skipping them also dropped 970 relationships that
happened to touch one.

User defined fields and activity codes now land as P6_UDF and
P6_ActivityCodes property sets. Separate sets because they are separate
concepts in P6, and not IfcClassificationReference for the codes because they
are orthogonal facets rather than a hierarchy. A code's description goes on
IfcProperty.Description so the short value and the readable one both survive.
UDF types come from the root declarations, since that is the only place the
data type is known, and are written sparsely.

Task times are now transcribed rather than recalculated. edit_task_time exists
to keep a schedule self-consistent while somebody edits it, so it snaps dates
off non-working days and derives durations across the calendar: reasonable for
an editor, wrong for a transcription where P6 has already run the critical path
and its answer is authoritative. On one 4,181 activity programme it moved 3,534
start dates and disagreed with P6's own duration on 3,206 activities. Actual
dates, early and late dates, float and completion are now carried too, none of
which were written before.

WBS children are created in P6's SequenceNumber order rather than document
order. IfcRelNests keeps an ordered list, so this is all it takes for a reader
to recover the breakdown as the planner arranged it, and sorting any other way
shows a programme nobody recognises.

Also: the project name was read without the namespace map, so every schedule
came out called "Unnamed".
2026-08-04 15:35:30 +10:00
Dion Moult 409373d882 Assign / unassign sequence should be specific to sequence type
I previously incorrectly believed that sequence types are mutually exclusive. E.g. you can have max 1 relationship between two tasks. Now after looking at more schedules I realise it's logically allowed to have more than one sequence relationship. For example simultaneous SS + FF.
2026-08-04 13:01:23 +10:00
Dion Moult e678012c71 ifcpatch: run FixArchiCADToRevitSpaces headlessly
The recipe loaded the model into Blender purely to reach its geometry
engine, so it could only run inside Bonsai and needed a filepath instead
of a file. It is now a plain BasePatcher.

The three fixes Revit needs are unchanged. To lower each space onto its
storey we take the storey elevation from util.placement and the space
placement from util.shape, instead of from Blender object matrices. To
convert to an extruded area solid we triangulate the space with
ifcopenshell.geom, union its downwards facing triangles with shapely to
get the footprint and its voids, and rebuild the body with
util.shape_builder.

Unioning every downwards facing face, rather than only the vertices
sitting at z=0, means stepped and clipped spaces keep their full
footprint, columns poking through a room become profile voids, and
disjoint footprints extrude as one item each. Spaces that cannot be
patched are logged and skipped rather than aborting the run, and a
storey above the top of a space falls back to the space's own height
instead of asking for a negative extrusion depth.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-04 12:16:46 +10:00
Dion Moult 0b8875669e Let the viewport composite over what is behind it
Background colour gains a meaningful alpha. Below 1 the viewport composites
over whatever the host has stacked behind it rather than painting a colour
of its own; at 0 it clears to nothing, so the model draws over another 3D
view, a map, or ordinary page content. There is no depth interaction -- the
layer behind is strictly behind and cannot occlude the model.

Honouring the alpha needs a premultiplied surface. configureSurface asks for
one only when the platform advertises it, the same way it picks a present
mode, and falls back to Auto otherwise -- this machine's Vulkan surface
offers opaque compositing only, so hardcoding premultiplied would have
requested a mode it does not support. The clear follows that choice: scaled
by alpha when premultiplied, held at 1 when not, since scaling would
otherwise just darken the colour for an alpha nobody reads.

ViewportWindow::setBackgroundColor now forwards to core rather than writing
through a reference proxy, dropping one more member from the friend
declaration it is meant to shrink. The screenshot QImage is tagged
premultiplied to match what the main pass leaves in the buffer.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-04 10:55:57 +10:00
Dion Moult c9f269a0e5 Draw a silhouette outline around the selection
The renderer tints the selection blue, which says nothing about an object
that is already blue. Add a halo drawn just outside the selected objects
instead: a fixed colour against the background, so it reads whatever the
element is painted.

The mask pass reuses the main shader module and pipeline layout and shares
the main depth buffer read-only, so the halo follows the selection as
visible -- an occluded object contributes nothing. A separable dilation
widens the mask into inner and outer rings, composited after the edge pass
so the edge multiply does not darken it.

On by default; IfcViewer.setSelectionOutline(false) gets the tint alone.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-04 10:55:57 +10:00
Andrej730 83a7836081 stub: document use_attribute_value_derived 2026-08-03 20:04:29 +05:00
Andrej730 cdf107e579 validate fixtures: validate expected error count 2026-08-03 19:51:10 +05:00
Andrej730 c1c94b9362 validate: document supported Path type 2026-08-03 18:44:06 +05:00
Andrej730 cb52013a5d validate: color output for readibility 2026-08-03 18:38:06 +05:00
Andrej730 de4ad60df3 validate: at the end print number of errors found 2026-08-03 18:24:59 +05:00
Andrej730 2fe177885e Drop unused log_entry_type named tuple (31cf1127a) 2026-08-03 18:24:47 +05:00
Andrej730 f457048285 rules fixtures: check number of expected failures 2026-08-03 17:51:26 +05:00
Andrej730 0e9ef70971 rules fixtures: append comment indicating fixture origin 2026-08-03 16:54:52 +05:00
Andrej730 ea0be33aa1 ifcopenshell.validate: typing for json logger statements 2026-08-03 16:54:52 +05:00
Andrej730 44ce7c7e8a rules fixture: nornallize headers
- to avoid some diffs on regeneration
- some fixtures had problems with the header, so `fail` for them wasn't
really testing the intended case, because small issues in the header
would make fixture fail regardless
2026-08-03 16:54:22 +05:00
Andrej730 e57c326ad1 rule fixtures: update fixture and generation script to match 4404470d9
IFCBSPLINECURVE is abstract and causing fail to fail even if point
dimensions wouldn't be checked.
2026-08-03 16:54:22 +05:00
Andrej730 5964160d67 rule fixtures: add missing generation scripts 2026-08-03 16:54:22 +05:00
Andrej730 26ab77bdf6 rule fixtures: script to regenerate all fixtures 2026-08-03 16:54:22 +05:00
Andrej730 7b2f4ad1cb rule fixture: update generation script to match a7e925b 2026-08-03 16:54:22 +05:00
Andrej730 8f67b905eb Fix ifcopenshell.file calls in rules fixtures, use simpler schema postfix 2026-08-03 16:54:22 +05:00
Andrej730 6edea83137 file.good - document return type 2026-08-03 16:54:22 +05:00
Andrej730 b1f388311c Return support for creating uninitialized files from Python
Created a new method to avoid complicating `ifcopenshell.file` ctor signature.
2026-08-03 16:54:22 +05:00
Andrej730 26b412cff6 Fix uses of ifcopenshell.file 2026-08-03 13:18:15 +05:00
Andrej730 a86667d063 Drop ignored delete_same_facet_edge_pairs from stub 2026-08-03 12:44:16 +05:00
Andrej730 b6fb5e6cdc IfcParseWrapper: ignore internal spf_header::assign 2026-08-03 12:44:00 +05:00