mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 23:36:20 +00:00
Fixed #3533 (also fixed the same issue for windows)
This commit is contained in:
@@ -265,7 +265,7 @@ class FilledOpeningGenerator:
|
|||||||
extrusion = shape_builder.extrude(
|
extrusion = shape_builder.extrude(
|
||||||
get_curve_2d_from_3d(profile),
|
get_curve_2d_from_3d(profile),
|
||||||
magnitude=thickness / unit_scale,
|
magnitude=thickness / unit_scale,
|
||||||
position=Vector([0.0, - thickness * 0.5 / unit_scale, 0.0]),
|
position=Vector([0.0, -thickness * 0.5 / unit_scale, 0.0]),
|
||||||
position_x_axis=Vector((1, 0, 0)),
|
position_x_axis=Vector((1, 0, 0)),
|
||||||
position_z_axis=Vector((0, -1, 0)),
|
position_z_axis=Vector((0, -1, 0)),
|
||||||
extrusion_vector=Vector((0, 0, -1)),
|
extrusion_vector=Vector((0, 0, -1)),
|
||||||
@@ -273,7 +273,7 @@ class FilledOpeningGenerator:
|
|||||||
return shape_builder.get_representation(context, [extrusion])
|
return shape_builder.get_representation(context, [extrusion])
|
||||||
|
|
||||||
x, y, z = filling_obj.dimensions
|
x, y, z = filling_obj.dimensions
|
||||||
opening_position = Vector([0.0, - thickness * 0.5 / unit_scale, 0.0])
|
opening_position = Vector([0.0, -thickness * 0.5 / unit_scale, 0.0])
|
||||||
opening_size = Vector([x, z]) / unit_scale
|
opening_size = Vector([x, z]) / unit_scale
|
||||||
|
|
||||||
# Windows and doors can have a casing that overlaps the wall
|
# Windows and doors can have a casing that overlaps the wall
|
||||||
@@ -754,27 +754,7 @@ class EditOpenings(Operator, tool.Ifc.Operator):
|
|||||||
tool.Ifc.unlink(element=opening, obj=opening_obj)
|
tool.Ifc.unlink(element=opening, obj=opening_obj)
|
||||||
bpy.data.objects.remove(opening_obj)
|
bpy.data.objects.remove(opening_obj)
|
||||||
|
|
||||||
decomposed_building_objs = set()
|
tool.Model.reload_body_representation(building_objs)
|
||||||
for obj in building_objs:
|
|
||||||
decomposed_building_objs.add(obj)
|
|
||||||
for subelement in ifcopenshell.util.element.get_decomposition(tool.Ifc.get_entity(obj)):
|
|
||||||
subobj = tool.Ifc.get_object(subelement)
|
|
||||||
if subobj:
|
|
||||||
decomposed_building_objs.add(subobj)
|
|
||||||
|
|
||||||
for obj in decomposed_building_objs:
|
|
||||||
if obj.data:
|
|
||||||
element = tool.Ifc.get_entity(obj)
|
|
||||||
body = ifcopenshell.util.representation.get_representation(element, "Model", "Body", "MODEL_VIEW")
|
|
||||||
blenderbim.core.geometry.switch_representation(
|
|
||||||
tool.Ifc,
|
|
||||||
tool.Geometry,
|
|
||||||
obj=obj,
|
|
||||||
representation=body,
|
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
should_sync_changes_first=False,
|
|
||||||
)
|
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
def get_all_building_objects_of_similar_openings(self, opening):
|
def get_all_building_objects_of_similar_openings(self, opening):
|
||||||
|
|||||||
@@ -82,18 +82,7 @@ def update_simple_openings(element, opening_width, opening_height):
|
|||||||
|
|
||||||
has_replaced_opening_representation = True
|
has_replaced_opening_representation = True
|
||||||
|
|
||||||
for obj in voided_objs:
|
tool.Model.reload_body_representation(voided_objs)
|
||||||
element = tool.Ifc.get_entity(obj)
|
|
||||||
body = ifcopenshell.util.representation.get_representation(element, "Model", "Body", "MODEL_VIEW")
|
|
||||||
blenderbim.core.geometry.switch_representation(
|
|
||||||
tool.Ifc,
|
|
||||||
tool.Geometry,
|
|
||||||
obj=obj,
|
|
||||||
representation=body,
|
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
should_sync_changes_first=False,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def update_window_modifier_representation(context, obj):
|
def update_window_modifier_representation(context, obj):
|
||||||
|
|||||||
@@ -767,3 +767,35 @@ class Model(blenderbim.core.tool.Model):
|
|||||||
obj.matrix_world = matrix
|
obj.matrix_world = matrix
|
||||||
return
|
return
|
||||||
tool.Ifc.run("geometry.edit_object_placement", product=element, matrix=matrix, is_si=True)
|
tool.Ifc.run("geometry.edit_object_placement", product=element, matrix=matrix, is_si=True)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def reload_body_representation(cls, obj_or_objects):
|
||||||
|
"""Update body representation including all decomposed objects"""
|
||||||
|
if isinstance(obj_or_objects, collections.abc.Iterable):
|
||||||
|
objects = set(obj_or_objects)
|
||||||
|
else:
|
||||||
|
objects = {obj_or_objects}
|
||||||
|
|
||||||
|
# decompose objects
|
||||||
|
decomposed_objs = objects.copy()
|
||||||
|
for obj in objects:
|
||||||
|
for subelement in ifcopenshell.util.element.get_decomposition(tool.Ifc.get_entity(obj)):
|
||||||
|
subobj = tool.Ifc.get_object(subelement)
|
||||||
|
if subobj:
|
||||||
|
decomposed_objs.add(subobj)
|
||||||
|
|
||||||
|
# update representation
|
||||||
|
for obj in decomposed_objs:
|
||||||
|
if not obj.data:
|
||||||
|
continue
|
||||||
|
element = tool.Ifc.get_entity(obj)
|
||||||
|
body = ifcopenshell.util.representation.get_representation(element, "Model", "Body", "MODEL_VIEW")
|
||||||
|
blenderbim.core.geometry.switch_representation(
|
||||||
|
tool.Ifc,
|
||||||
|
tool.Geometry,
|
||||||
|
obj=obj,
|
||||||
|
representation=body,
|
||||||
|
should_reload=True,
|
||||||
|
is_global=True,
|
||||||
|
should_sync_changes_first=False,
|
||||||
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user