mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
Accommodate invalid missing mapped representations and items coming from Tekla (2023)
This commit is contained in:
@@ -428,7 +428,7 @@ class IfcImporter:
|
|||||||
|
|
||||||
rep = representation
|
rep = representation
|
||||||
while True:
|
while True:
|
||||||
if len(rep.Items) == 1 and rep.Items[0].is_a("IfcMappedItem"):
|
if rep.Items and len(rep.Items) == 1 and rep.Items[0].is_a("IfcMappedItem"):
|
||||||
rep_matrix = ifcopenshell.util.placement.get_mappeditem_transformation(rep.Items[0])
|
rep_matrix = ifcopenshell.util.placement.get_mappeditem_transformation(rep.Items[0])
|
||||||
if not np.allclose(rep_matrix, np.eye(4)):
|
if not np.allclose(rep_matrix, np.eye(4)):
|
||||||
matrix = rep_matrix @ matrix
|
matrix = rep_matrix @ matrix
|
||||||
|
|||||||
@@ -294,8 +294,12 @@ def resolve_representation(representation: ifcopenshell.entity_instance) -> ifco
|
|||||||
:param representation: IfcRepresentation
|
:param representation: IfcRepresentation
|
||||||
:return: Representation resolved from mappings
|
:return: Representation resolved from mappings
|
||||||
"""
|
"""
|
||||||
if len(representation.Items) == 1 and representation.Items[0].is_a("IfcMappedItem"):
|
if (
|
||||||
return resolve_representation(representation.Items[0].MappingSource.MappedRepresentation)
|
len(representation.Items or []) == 1
|
||||||
|
and representation.Items[0].is_a("IfcMappedItem")
|
||||||
|
and (mapped_rep := representation.Items[0].MappingSource.MappedRepresentation)
|
||||||
|
):
|
||||||
|
return resolve_representation(mapped_rep)
|
||||||
return representation
|
return representation
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user