mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-21 14:23:53 +00:00
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.
This commit is contained in:
committed by
Thomas Krijnen
parent
007cdce98c
commit
481becfc05
@@ -623,6 +623,12 @@ private:
|
||||
// @nb we don't check anymore if the attribute is optional here, because it should be
|
||||
// possible to go back to the state at construction time.
|
||||
// bool is_optional = $self->declaration().as_entity()->attribute_by_index(i)->optional();
|
||||
// A derived attribute keeps its derived marker, as at construction time.
|
||||
auto* ent = $self->declaration().as_entity();
|
||||
if (ent && i < ent->derived().size() && ent->derived()[i]) {
|
||||
self->set_attribute_value(i, ifcopenshell::derived{});
|
||||
return;
|
||||
}
|
||||
self->set_attribute_value(i, blank{});
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user