mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-07 00:11:36 +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:
|
||||
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(
|
||||
tool.Ifc,
|
||||
tool.Geometry,
|
||||
|
||||
@@ -103,24 +103,32 @@ def switch_representation(
|
||||
if not geometry.does_representation_id_exist(representation_id):
|
||||
return
|
||||
|
||||
representation = geometry.resolve_mapped_representation(representation)
|
||||
existing_data = geometry.get_representation_data(representation)
|
||||
entity = ifc.get_entity(obj)
|
||||
|
||||
if should_reload or not existing_data:
|
||||
data = geometry.import_representation(obj, representation, apply_openings=apply_openings)
|
||||
geometry.rename_object(data, geometry.get_representation_name(representation))
|
||||
geometry.link(representation, data)
|
||||
# doesn't resolve mapped representations in case if it's going to have openings
|
||||
# otherwise we would also add openings to the type and other occurences mesh data
|
||||
has_openings = apply_openings and entity.HasOpenings
|
||||
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:
|
||||
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)
|
||||
|
||||
if should_reload and existing_data:
|
||||
geometry.delete_data(existing_data)
|
||||
# we assume that all the occurences and the type have the same representation context active
|
||||
# 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_cache(ifc.get_entity(obj))
|
||||
geometry.clear_cache(entity)
|
||||
|
||||
|
||||
def get_representation_ifc_parameters(geometry, obj=None, should_sync_changes_first=False):
|
||||
|
||||
Reference in New Issue
Block a user