See #4007. Now clone opening works also when a opening hosts a window or a door

This commit is contained in:
Massimo Fabbro
2024-01-28 17:17:41 +01:00
committed by Massimo Fabbro
parent 2db35556e9
commit 5c7271ddc8
@@ -1120,11 +1120,11 @@ class DumbWallJoiner:
other = tool.Ifc.get_object(rel.RelatedElement) other = tool.Ifc.get_object(rel.RelatedElement)
if connection not in ["ATPATH", "NOTDEFINED"]: if connection not in ["ATPATH", "NOTDEFINED"]:
self.join( self.join(
obj, obj,
other, other,
connection, connection,
rel.RelatedConnectionType, rel.RelatedConnectionType,
is_relating=True, is_relating=True,
description=rel.Description description=rel.Description
) )
for rel in element.ConnectedFrom: for rel in element.ConnectedFrom:
@@ -1226,6 +1226,7 @@ class DumbWallJoiner:
# If opening has filling then stick to the filling's position # If opening has filling then stick to the filling's position
# We're applying new openings position only after wall position is applied # We're applying new openings position only after wall position is applied
for opening in [r.RelatedOpeningElement for r in element.HasOpenings if r.RelatedOpeningElement.HasFillings]: for opening in [r.RelatedOpeningElement for r in element.HasOpenings if r.RelatedOpeningElement.HasFillings]:
similar_openings = blenderbim.core.geometry.get_similar_openings(tool.Ifc, opening)
filling_obj = tool.Ifc.get_object(opening.HasFillings[0].RelatedBuildingElement) filling_obj = tool.Ifc.get_object(opening.HasFillings[0].RelatedBuildingElement)
filling_moved = tool.Ifc.is_moved(filling_obj) filling_moved = tool.Ifc.is_moved(filling_obj)
if filling_moved: if filling_moved:
@@ -1234,6 +1235,7 @@ class DumbWallJoiner:
ifcopenshell.api.run( ifcopenshell.api.run(
"geometry.edit_object_placement", tool.Ifc.get(), product=opening, matrix=filling_obj.matrix_world "geometry.edit_object_placement", tool.Ifc.get(), product=opening, matrix=filling_obj.matrix_world
) )
blenderbim.core.geometry.edit_similar_opening_placement(tool.Geometry, opening, similar_openings)
blenderbim.core.geometry.switch_representation( blenderbim.core.geometry.switch_representation(
tool.Ifc, tool.Ifc,