New import code profiler in the IFC debug panel

This commit is contained in:
Dion Moult
2020-12-20 13:48:31 +11:00
parent 3eee5aba78
commit c16b63e5ae
3 changed files with 17 additions and 0 deletions
@@ -49,6 +49,7 @@ if bpy is not None:
operator.ValidateIfcFile,
operator.ExportIFC,
operator.ImportIFC,
operator.ProfileImportIFC,
operator.ColourByClass,
operator.ColourByAttribute,
operator.ColourByPset,
@@ -138,6 +138,19 @@ class ImportIFC(bpy.types.Operator, ImportHelper):
return {"FINISHED"}
class ProfileImportIFC(bpy.types.Operator):
bl_idname = "bim.profile_import_ifc"
bl_label = "Profile Import IFC"
def execute(self, context):
import cProfile
import pstats
cProfile.run(f"import bpy; bpy.ops.import_ifc.bim(filepath='{bpy.context.scene.BIMProperties.ifc_file}')", "blender.prof")
p = pstats.Stats("blender.prof")
p.sort_stats("cumulative").print_stats(50)
return {"FINISHED"}
class SelectGlobalId(bpy.types.Operator):
bl_idname = "bim.select_global_id"
bl_label = "Select GlobalId"
@@ -2541,6 +2541,9 @@ class BIM_PT_debug(Panel):
scene = context.scene
props = scene.BIMDebugProperties
row = layout.row()
row.operator("bim.profile_import_ifc")
row = layout.row()
row.prop(props, "step_id", text="")
row = layout.row()