mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Fixed adding opening to meshes of all occurences for non material based representations
Mentioned in #3817
This commit is contained in:
@@ -160,7 +160,10 @@ class FilledOpeningGenerator:
|
|||||||
|
|
||||||
for voided_obj in voided_objs:
|
for voided_obj in voided_objs:
|
||||||
if voided_obj.data:
|
if voided_obj.data:
|
||||||
representation = tool.Ifc.get().by_id(voided_obj.data.BIMMeshProperties.ifc_definition_id)
|
voided_element = tool.Ifc.get_entity(voided_obj)
|
||||||
|
context = tool.Geometry.get_active_representation_context(voided_obj)
|
||||||
|
representation = tool.Geometry.get_representation_by_context(voided_element, context)
|
||||||
|
|
||||||
blenderbim.core.geometry.switch_representation(
|
blenderbim.core.geometry.switch_representation(
|
||||||
tool.Ifc,
|
tool.Ifc,
|
||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
|
|||||||
@@ -103,24 +103,32 @@ def switch_representation(
|
|||||||
if not geometry.does_representation_id_exist(representation_id):
|
if not geometry.does_representation_id_exist(representation_id):
|
||||||
return
|
return
|
||||||
|
|
||||||
representation = geometry.resolve_mapped_representation(representation)
|
entity = ifc.get_entity(obj)
|
||||||
existing_data = geometry.get_representation_data(representation)
|
|
||||||
|
|
||||||
if should_reload or not existing_data:
|
# doesn't resolve mapped representations in case if it's going to have openings
|
||||||
data = geometry.import_representation(obj, representation, apply_openings=apply_openings)
|
# otherwise we would also add openings to the type and other occurences mesh data
|
||||||
geometry.rename_object(data, geometry.get_representation_name(representation))
|
has_openings = apply_openings and entity.HasOpenings
|
||||||
geometry.link(representation, data)
|
if not has_openings:
|
||||||
|
representation = geometry.resolve_mapped_representation(representation)
|
||||||
|
|
||||||
|
old_repr_data = geometry.get_representation_data(representation)
|
||||||
|
if should_reload or not old_repr_data:
|
||||||
|
new_repr_data = geometry.import_representation(obj, representation, apply_openings=apply_openings)
|
||||||
|
geometry.rename_object(new_repr_data, geometry.get_representation_name(representation))
|
||||||
|
geometry.link(representation, new_repr_data)
|
||||||
else:
|
else:
|
||||||
data = existing_data
|
new_repr_data = old_repr_data
|
||||||
|
|
||||||
geometry.change_object_data(obj, data, is_global=is_global)
|
geometry.change_object_data(obj, new_repr_data, is_global=is_global and not has_openings)
|
||||||
geometry.record_object_materials(obj)
|
geometry.record_object_materials(obj)
|
||||||
|
|
||||||
if should_reload and existing_data:
|
# we assume that all the occurences and the type have the same representation context active
|
||||||
geometry.delete_data(existing_data)
|
# so geometry.delete_data cannot remove the data that's still used by some other object
|
||||||
|
if should_reload and old_repr_data:
|
||||||
|
geometry.delete_data(old_repr_data)
|
||||||
|
|
||||||
geometry.clear_modifiers(obj)
|
geometry.clear_modifiers(obj)
|
||||||
geometry.clear_cache(ifc.get_entity(obj))
|
geometry.clear_cache(entity)
|
||||||
|
|
||||||
|
|
||||||
def get_representation_ifc_parameters(geometry, obj=None, should_sync_changes_first=False):
|
def get_representation_ifc_parameters(geometry, obj=None, should_sync_changes_first=False):
|
||||||
|
|||||||
Reference in New Issue
Block a user