More meaningful percentage completion in console when loading models

This commit is contained in:
Dion Moult
2022-06-06 09:59:32 +10:00
parent 54b82fd149
commit 00e46ce39e
+11 -9
View File
@@ -592,12 +592,13 @@ class IfcImporter:
return representation_map return representation_map
def create_native_elements(self): def create_native_elements(self):
total = 0 progress = 0
checkpoint = time.time() checkpoint = time.time()
total = len(self.native_elements)
for element in self.native_elements: for element in self.native_elements:
total += 1 progress += 1
if total % 250 == 0: if progress % 250 == 0:
print("{} elements processed in {:.2f}s ...".format(total, time.time() - checkpoint)) print("{} / {} elements processed in {:.2f}s ...".format(progress, total, time.time() - checkpoint))
checkpoint = time.time() checkpoint = time.time()
native_data = self.native_data[element.GlobalId] native_data = self.native_data[element.GlobalId]
representation = native_data["representation"] representation = native_data["representation"]
@@ -657,15 +658,16 @@ class IfcImporter:
if not valid_file: if not valid_file:
return results return results
checkpoint = time.time() checkpoint = time.time()
total = 0 progress = 0
total = len(products)
start_progress = self.progress start_progress = self.progress
progress_range = 85 - start_progress progress_range = 85 - start_progress
while True: while True:
total += 1 progress += 1
if total % 250 == 0: if progress % 250 == 0:
print( print(
"{} ({}%) elements processed in {:.2f}s ...".format( "{} / {} ({}% preprocessed) elements processed in {:.2f}s ...".format(
total, iterator.progress(), time.time() - checkpoint progress, total, iterator.progress(), time.time() - checkpoint
) )
) )
checkpoint = time.time() checkpoint = time.time()