mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 06:58:56 +00:00
Fix #5237. Fix bug where flipping or splitting walls didn't take into account project units and voids were misplaced.
This commit is contained in:
@@ -66,7 +66,6 @@ class FilledOpeningGenerator:
|
|||||||
target: Optional[Vector] = None,
|
target: Optional[Vector] = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
props = bpy.context.scene.BIMModelProperties
|
props = bpy.context.scene.BIMModelProperties
|
||||||
unit_scale = ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get())
|
|
||||||
opening_thickness_si = 0.0
|
opening_thickness_si = 0.0
|
||||||
|
|
||||||
filling = tool.Ifc.get_entity(filling_obj)
|
filling = tool.Ifc.get_entity(filling_obj)
|
||||||
|
|||||||
@@ -1041,6 +1041,8 @@ class DumbWallJoiner:
|
|||||||
self.recreate_wall(element1, wall1, axis, body)
|
self.recreate_wall(element1, wall1, axis, body)
|
||||||
|
|
||||||
def split(self, wall1, target):
|
def split(self, wall1, target):
|
||||||
|
unit_scale = ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get())
|
||||||
|
|
||||||
element1 = tool.Ifc.get_entity(wall1)
|
element1 = tool.Ifc.get_entity(wall1)
|
||||||
if not element1:
|
if not element1:
|
||||||
return
|
return
|
||||||
@@ -1064,6 +1066,7 @@ class DumbWallJoiner:
|
|||||||
r.RelatedOpeningElement for r in element1.HasOpenings if not r.RelatedOpeningElement.HasFillings
|
r.RelatedOpeningElement for r in element1.HasOpenings if not r.RelatedOpeningElement.HasFillings
|
||||||
]:
|
]:
|
||||||
opening_matrix = Matrix(ifcopenshell.util.placement.get_local_placement(opening.ObjectPlacement).tolist())
|
opening_matrix = Matrix(ifcopenshell.util.placement.get_local_placement(opening.ObjectPlacement).tolist())
|
||||||
|
opening_matrix.translation *= unit_scale
|
||||||
opening_location = opening_matrix.translation
|
opening_location = opening_matrix.translation
|
||||||
_, opening_position = mathutils.geometry.intersect_point_line(opening_location.to_2d(), *axis1["reference"])
|
_, opening_position = mathutils.geometry.intersect_point_line(opening_location.to_2d(), *axis1["reference"])
|
||||||
if opening_position > cut_percentage:
|
if opening_position > cut_percentage:
|
||||||
@@ -1075,6 +1078,7 @@ class DumbWallJoiner:
|
|||||||
r.RelatedOpeningElement for r in element2.HasOpenings if not r.RelatedOpeningElement.HasFillings
|
r.RelatedOpeningElement for r in element2.HasOpenings if not r.RelatedOpeningElement.HasFillings
|
||||||
]:
|
]:
|
||||||
opening_matrix = Matrix(ifcopenshell.util.placement.get_local_placement(opening.ObjectPlacement).tolist())
|
opening_matrix = Matrix(ifcopenshell.util.placement.get_local_placement(opening.ObjectPlacement).tolist())
|
||||||
|
opening_matrix.translation *= unit_scale
|
||||||
opening_location = opening_matrix.translation
|
opening_location = opening_matrix.translation
|
||||||
_, opening_position = mathutils.geometry.intersect_point_line(opening_location.to_2d(), *axis1["reference"])
|
_, opening_position = mathutils.geometry.intersect_point_line(opening_location.to_2d(), *axis1["reference"])
|
||||||
if opening_position < cut_percentage:
|
if opening_position < cut_percentage:
|
||||||
@@ -1097,6 +1101,8 @@ class DumbWallJoiner:
|
|||||||
self.recreate_wall(element2, wall2, axis2["reference"], axis2["reference"])
|
self.recreate_wall(element2, wall2, axis2["reference"], axis2["reference"])
|
||||||
|
|
||||||
def flip(self, wall1):
|
def flip(self, wall1):
|
||||||
|
unit_scale = ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get())
|
||||||
|
|
||||||
if tool.Ifc.is_moved(wall1):
|
if tool.Ifc.is_moved(wall1):
|
||||||
bonsai.core.geometry.edit_object_placement(tool.Ifc, tool.Geometry, tool.Surveyor, obj=wall1)
|
bonsai.core.geometry.edit_object_placement(tool.Ifc, tool.Geometry, tool.Surveyor, obj=wall1)
|
||||||
|
|
||||||
@@ -1125,6 +1131,7 @@ class DumbWallJoiner:
|
|||||||
filling_matrixes = {}
|
filling_matrixes = {}
|
||||||
for opening in [r.RelatedOpeningElement for r in element1.HasOpenings]:
|
for opening in [r.RelatedOpeningElement for r in element1.HasOpenings]:
|
||||||
opening_matrix = Matrix(ifcopenshell.util.placement.get_local_placement(opening.ObjectPlacement).tolist())
|
opening_matrix = Matrix(ifcopenshell.util.placement.get_local_placement(opening.ObjectPlacement).tolist())
|
||||||
|
opening_matrix.translation *= unit_scale
|
||||||
location = opening_matrix.translation
|
location = opening_matrix.translation
|
||||||
location_on_base = tool.Cad.point_on_edge(location, axis1["base"])
|
location_on_base = tool.Cad.point_on_edge(location, axis1["base"])
|
||||||
location_on_side = tool.Cad.point_on_edge(location, axis1["side"])
|
location_on_side = tool.Cad.point_on_edge(location, axis1["side"])
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ class AddOpening(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
props = context.scene.BIMModelProperties
|
|
||||||
selected_objects = context.selected_objects
|
selected_objects = context.selected_objects
|
||||||
target_object = selected_objects[0]
|
target_object = selected_objects[0]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user