From 523ac48afc9f6ee715d541a6497791464fc47d43 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Sun, 9 Oct 2011 09:07:33 +0000 Subject: [PATCH] - Progress bar in Blender console - Fix bug freeing objects multiple times in IfcGeomObjects::CleanUp() --- src/ifcblender/io_import_scene_ifc/__init__.py | 8 ++++++++ src/ifcgeom/IfcGeomObjects.cpp | 1 + 2 files changed, 9 insertions(+) diff --git a/src/ifcblender/io_import_scene_ifc/__init__.py b/src/ifcblender/io_import_scene_ifc/__init__.py index 13f96866b1..78e113859b 100644 --- a/src/ifcblender/io_import_scene_ifc/__init__.py +++ b/src/ifcblender/io_import_scene_ifc/__init__.py @@ -79,6 +79,8 @@ class ImportIFC(bpy.types.Operator, ImportHelper): return {'FINISHED'} id_to_object = {} id_to_parent = {} + old_progress = -1 + print ("Creating geometry...") while True: ob = IfcImport.Get() if ob.type != 'IfcOpeningElement': @@ -123,8 +125,14 @@ class ImportIFC(bpy.types.Operator, ImportHelper): if ob.parent_id > 0: id_to_parent[ob.id] = ob.parent_id + progress = IfcImport.Progress() // 2 + if progress > old_progress: + print ("\r[" + "=" * progress + " " * (50 - progress) + "]",end="") + old_progress = progress if not IfcImport.Next(): break + + print ("\rDone creating geometry"+" "*30) while len(id_to_parent) and self.process_relations: id, parent_id = id_to_parent.popitem() diff --git a/src/ifcgeom/IfcGeomObjects.cpp b/src/ifcgeom/IfcGeomObjects.cpp index a45f4bb72a..c65555c61f 100644 --- a/src/ifcgeom/IfcGeomObjects.cpp +++ b/src/ifcgeom/IfcGeomObjects.cpp @@ -309,6 +309,7 @@ bool IfcGeomObjects::CleanUp() { ++ it ) { delete *it; } + returned_objects.clear(); return true; } const IfcGeomObjects::IfcObject* IfcGeomObjects::GetObject(int id) {