From 248ac712159422d6a0a2cb49fded816ea5b8c97f Mon Sep 17 00:00:00 2001 From: Martin15135215 <110968398+Martin15135215@users.noreply.github.com> Date: Sat, 3 Sep 2022 19:13:55 +0200 Subject: [PATCH] From append methode to use numpy --- src/blenderbim/scripts/obj2ifc.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/blenderbim/scripts/obj2ifc.py b/src/blenderbim/scripts/obj2ifc.py index 4dec3c5095..0e7210d613 100644 --- a/src/blenderbim/scripts/obj2ifc.py +++ b/src/blenderbim/scripts/obj2ifc.py @@ -25,6 +25,7 @@ import ifcopenshell.api import ifcopenshell.api.owner.settings from pathlib import Path +import numpy as np class Obj2Ifc: def __init__(self, path): @@ -35,9 +36,11 @@ class Obj2Ifc: self.create_ifc_file(version) self.scene = pywavefront.Wavefront(self.path, create_materials=True, collect_faces=True) for mesh in self.scene.mesh_list: - ifc_faces = [] - for face in mesh.faces: - ifc_faces.append( + + faces = mesh.faces + ifc_faces = np.zeros([len(faces)], dtype=object) + for i, face in enumerate(faces): + ifc_faces[i] = ( self.file.createIfcFace( [ self.file.createIfcFaceOuterBound( @@ -57,7 +60,7 @@ class Obj2Ifc: self.context, "Body", "Brep", - [self.file.createIfcFacetedBrep(self.file.createIfcClosedShell(ifc_faces))], + [self.file.createIfcFacetedBrep(self.file.createIfcClosedShell(ifc_faces.tolist()))], ) ], )