See #1227. Don't move any child at all when regenerating wall body.

This commit is contained in:
Dion Moult
2025-03-09 18:00:13 +11:00
parent 5fa4f2e79b
commit e78127d54f
4 changed files with 16 additions and 52 deletions
@@ -155,7 +155,7 @@ class Usecase:
elif obj.is_a("IfcFeatureElement"):
# Feature elements affect the geometry of their parent, and
# so logically should always move with the parent. However,
# subchildren shouldn't move.
# subchildren (fillings) shouldn't move.
placement2 = obj.ObjectPlacement
for referenced_placement2 in placement2.ReferencedByPlacements:
matrix2 = ifcopenshell.util.placement.get_local_placement(referenced_placement2)
@@ -311,12 +311,24 @@ class Regenerator:
ifcopenshell.api.geometry.assign_representation(self.file, product=wall, representation=axis_rep)
if not np.allclose(self.reference_p1, np.array((0.0, 0.0))):
children = []
for referenced_placement in wall.ObjectPlacement.ReferencedByPlacements:
matrix = ifcopenshell.util.placement.get_local_placement(referenced_placement)
children.append((matrix, referenced_placement.PlacesObject))
matrix = ifcopenshell.util.placement.get_local_placement(wall.ObjectPlacement)
matrix[:, 3] = matrix @ np.concatenate((self.reference_p1, (0, 1)))
ifcopenshell.api.geometry.edit_object_placement(
self.file, product=wall, matrix=matrix, is_si=False, should_transform_children=False
self.file, product=wall, matrix=matrix, is_si=False, should_transform_children=True
)
# Restore children to their previous location
for matrix, elements in children:
for element in elements:
ifcopenshell.api.geometry.edit_object_placement(
self.file, product=element, matrix=matrix, is_si=False, should_transform_children=True
)
return body_rep
def join(self, wall1, wall2, layers1, layers2, connection1, connection2):