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
def create_native_elements(self):
total = 0
progress = 0
checkpoint = time.time()
total = len(self.native_elements)
for element in self.native_elements:
total += 1
if total % 250 == 0:
print("{} elements processed in {:.2f}s ...".format(total, time.time() - checkpoint))
progress += 1
if progress % 250 == 0:
print("{} / {} elements processed in {:.2f}s ...".format(progress, total, time.time() - checkpoint))
checkpoint = time.time()
native_data = self.native_data[element.GlobalId]
representation = native_data["representation"]
@@ -657,15 +658,16 @@ class IfcImporter:
if not valid_file:
return results
checkpoint = time.time()
total = 0
progress = 0
total = len(products)
start_progress = self.progress
progress_range = 85 - start_progress
while True:
total += 1
if total % 250 == 0:
progress += 1
if progress % 250 == 0:
print(
"{} ({}%) elements processed in {:.2f}s ...".format(
total, iterator.progress(), time.time() - checkpoint
"{} / {} ({}% preprocessed) elements processed in {:.2f}s ...".format(
progress, total, iterator.progress(), time.time() - checkpoint
)
)
checkpoint = time.time()