Skip to content
This repository was archived by the owner on Nov 24, 2024. It is now read-only.

Commit c16b63e

Browse files
committed
New import code profiler in the IFC debug panel
1 parent 3eee5ab commit c16b63e

3 files changed

Lines changed: 17 additions & 0 deletions

File tree

src/ifcblenderexport/blenderbim/bim/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
operator.ValidateIfcFile,
5050
operator.ExportIFC,
5151
operator.ImportIFC,
52+
operator.ProfileImportIFC,
5253
operator.ColourByClass,
5354
operator.ColourByAttribute,
5455
operator.ColourByPset,

src/ifcblenderexport/blenderbim/bim/operator.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,19 @@ def execute(self, context):
138138
return {"FINISHED"}
139139

140140

141+
class ProfileImportIFC(bpy.types.Operator):
142+
bl_idname = "bim.profile_import_ifc"
143+
bl_label = "Profile Import IFC"
144+
145+
def execute(self, context):
146+
import cProfile
147+
import pstats
148+
cProfile.run(f"import bpy; bpy.ops.import_ifc.bim(filepath='{bpy.context.scene.BIMProperties.ifc_file}')", "blender.prof")
149+
p = pstats.Stats("blender.prof")
150+
p.sort_stats("cumulative").print_stats(50)
151+
return {"FINISHED"}
152+
153+
141154
class SelectGlobalId(bpy.types.Operator):
142155
bl_idname = "bim.select_global_id"
143156
bl_label = "Select GlobalId"

src/ifcblenderexport/blenderbim/bim/ui.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2541,6 +2541,9 @@ def draw(self, context):
25412541
scene = context.scene
25422542
props = scene.BIMDebugProperties
25432543

2544+
row = layout.row()
2545+
row.operator("bim.profile_import_ifc")
2546+
25442547
row = layout.row()
25452548
row.prop(props, "step_id", text="")
25462549
row = layout.row()

0 commit comments

Comments
 (0)