mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-28 03:05:33 +00:00
New recalculate wall operator to manually trigger an update of all wall connections
This commit is contained in:
@@ -30,6 +30,7 @@ classes = (
|
|||||||
wall.AlignWall,
|
wall.AlignWall,
|
||||||
wall.FlipWall,
|
wall.FlipWall,
|
||||||
wall.SplitWall,
|
wall.SplitWall,
|
||||||
|
wall.RecalculateWall,
|
||||||
opening.AddElementOpening,
|
opening.AddElementOpening,
|
||||||
profile.ExtendProfile,
|
profile.ExtendProfile,
|
||||||
prop.BIMModelProperties,
|
prop.BIMModelProperties,
|
||||||
|
|||||||
@@ -185,6 +185,20 @@ class SplitWall(bpy.types.Operator):
|
|||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
|
class RecalculateWall(bpy.types.Operator):
|
||||||
|
bl_idname = "bim.recalculate_wall"
|
||||||
|
bl_label = "Recalculate Wall"
|
||||||
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def poll(cls, context):
|
||||||
|
return context.selected_objects
|
||||||
|
|
||||||
|
def execute(self, context):
|
||||||
|
DumbWallRecalculator().recalculate(context.selected_objects)
|
||||||
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
def recalculate_dumb_wall_origin(wall, new_origin=None):
|
def recalculate_dumb_wall_origin(wall, new_origin=None):
|
||||||
if new_origin is None:
|
if new_origin is None:
|
||||||
new_origin = wall.matrix_world @ Vector(wall.bound_box[0])
|
new_origin = wall.matrix_world @ Vector(wall.bound_box[0])
|
||||||
@@ -369,6 +383,20 @@ class DumbWallAligner:
|
|||||||
return round(degrees(angle) % 360) == 180
|
return round(degrees(angle) % 360) == 180
|
||||||
|
|
||||||
|
|
||||||
|
class DumbWallRecalculator:
|
||||||
|
def recalculate(self, walls):
|
||||||
|
queue = set()
|
||||||
|
for wall in walls:
|
||||||
|
element = tool.Ifc.get_entity(wall)
|
||||||
|
queue.add((element, wall))
|
||||||
|
for rel in getattr(element, "ConnectedTo", []):
|
||||||
|
queue.add((rel.RelatedElement, tool.Ifc.get_object(rel.RelatedElement)))
|
||||||
|
for rel in getattr(element, "ConnectedFrom", []):
|
||||||
|
queue.add((rel.RelatingElement, tool.Ifc.get_object(rel.RelatingElement)))
|
||||||
|
joiner = DumbWallJoiner()
|
||||||
|
for element, wall in queue:
|
||||||
|
if wall:
|
||||||
|
joiner.recreate_wall(element, wall)
|
||||||
|
|
||||||
|
|
||||||
class DumbWallGenerator:
|
class DumbWallGenerator:
|
||||||
|
|||||||
Reference in New Issue
Block a user