mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 18:43:26 +00:00
Resync wall props after dimension mutation
ChangeExtrusionDepth, ChangeExtrusionXAngle, and ChangeLayerLength mutate IFC extrusion / axis but never re-prime BIMWallProperties from the post-mutation state. Gizmo icons that position from props.height then sit at the pre-mutation elevation even though the wall mesh shows the new one — visible asymmetry against the workspace header H field which redraws live. Add the existing _resync_walls_after_mutation call to each operator's epilogue. _maybe_resync_wall_props_from_ifc already skips non-walls and walls in edit mode, so calling on the raw selection list is safe. Generated with the assistance of an AI coding tool.
This commit is contained in:
@@ -811,6 +811,7 @@ class ChangeExtrusionDepth(bpy.types.Operator, tool.Ifc.Operator):
|
||||
|
||||
if layer2_objs:
|
||||
tool.Model.recalculate_walls(layer2_objs)
|
||||
_resync_walls_after_mutation(layer2_objs)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@@ -926,6 +927,7 @@ class ChangeExtrusionXAngle(bpy.types.Operator, tool.Ifc.Operator):
|
||||
|
||||
if layer2_objs:
|
||||
tool.Model.recalculate_walls(layer2_objs)
|
||||
_resync_walls_after_mutation(layer2_objs)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@@ -948,6 +950,7 @@ class ChangeLayerLength(bpy.types.Operator, tool.Ifc.Operator):
|
||||
selected_objs = tool.Model.get_selected_mesh_ifc_objects()
|
||||
for obj in selected_objs:
|
||||
joiner.set_length(obj, self.length)
|
||||
_resync_walls_after_mutation(selected_objs)
|
||||
|
||||
|
||||
class OffsetWalls(bpy.types.Operator, tool.Ifc.Operator):
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
# Bonsai - OpenBIM Blender Add-on
|
||||
# Copyright (C) 2026
|
||||
#
|
||||
# This file is part of Bonsai.
|
||||
#
|
||||
# Bonsai is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Bonsai is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# This file was generated with the assistance of an AI coding tool.
|
||||
|
||||
"""Pins the contract that the three dimension-mutating wall operators —
|
||||
``bim.change_extrusion_depth``, ``bim.change_extrusion_x_angle``,
|
||||
``bim.change_layer_length`` — re-prime ``BIMWallProperties`` from the
|
||||
post-mutation IFC at the end of ``_execute``.
|
||||
|
||||
Without the resync, ``props.height`` / ``props.length`` / ``props.x_angle``
|
||||
stay at their pre-mutation values; gizmo icons that position from
|
||||
``props.height`` then sit at the old elevation even though the wall mesh
|
||||
shows the new one."""
|
||||
|
||||
import inspect
|
||||
|
||||
import pytest
|
||||
|
||||
pytestmark = pytest.mark.wall
|
||||
|
||||
|
||||
def _execute_source(operator_cls):
|
||||
return inspect.getsource(operator_cls._execute)
|
||||
|
||||
|
||||
def test_change_extrusion_depth_resyncs_wall_props():
|
||||
from bonsai.bim.module.model.wall import ChangeExtrusionDepth
|
||||
|
||||
assert "_resync_walls_after_mutation" in _execute_source(ChangeExtrusionDepth)
|
||||
|
||||
|
||||
def test_change_extrusion_x_angle_resyncs_wall_props():
|
||||
from bonsai.bim.module.model.wall import ChangeExtrusionXAngle
|
||||
|
||||
assert "_resync_walls_after_mutation" in _execute_source(ChangeExtrusionXAngle)
|
||||
|
||||
|
||||
def test_change_layer_length_resyncs_wall_props():
|
||||
from bonsai.bim.module.model.wall import ChangeLayerLength
|
||||
|
||||
assert "_resync_walls_after_mutation" in _execute_source(ChangeLayerLength)
|
||||
Reference in New Issue
Block a user