mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
remove_representation - optimization
In some cases remove_representation got 2x times faster (when there were a lot representation items that are not IfcTessellatedFaceSets). getattr with attribute that might not be present on the element could be much slower then checking it's class explicitly.
This commit is contained in:
@@ -51,8 +51,9 @@ def remove_representation(
|
|||||||
for s in subelement.LayerAssignment if not is_ifc2x3 else subelement.LayerAssignments:
|
for s in subelement.LayerAssignment if not is_ifc2x3 else subelement.LayerAssignments:
|
||||||
presentation_layer_assignments_items.add(s)
|
presentation_layer_assignments_items.add(s)
|
||||||
# IfcTessellatedFaceSet inverses
|
# IfcTessellatedFaceSet inverses
|
||||||
[textures.add(t) for t in getattr(subelement, "HasTextures", []) or []]
|
if subelement.is_a() == "IfcTessellatedFaceSet":
|
||||||
[colours.add(t) for t in getattr(subelement, "HasColours", []) or []]
|
textures.update(subelement.HasTextures)
|
||||||
|
colours.update(subelement.HasColours)
|
||||||
elif subelement.is_a("IfcRepresentation"):
|
elif subelement.is_a("IfcRepresentation"):
|
||||||
for layer in subelement.LayerAssignments:
|
for layer in subelement.LayerAssignments:
|
||||||
presentation_layer_assignments_reps.add(layer)
|
presentation_layer_assignments_reps.add(layer)
|
||||||
|
|||||||
Reference in New Issue
Block a user