Add to debug UI an operator to toggle detailed ifcopenshell logs

https://i.imgur.com/tqwRSYs.png

Ping @theoryshaw just in case, I can image Ryan finding lots of edge cases in v0.8.0 and this can help narrow them down😁
This commit is contained in:
Andrej730
2024-07-10 14:33:28 +05:00
parent 83a0d7a63c
commit 472e2f8e59
3 changed files with 37 additions and 0 deletions
@@ -40,6 +40,7 @@ classes = (
operator.SelectExpressFile,
operator.SelectHighPolygonMeshes,
operator.SelectHighestPolygonMeshes,
operator.ToggleDetailedIOSLogs,
operator.ValidateIfcFile,
prop.BIMDebugProperties,
ui.BIM_PT_debug,
@@ -724,3 +724,36 @@ class DebugActiveDrawing(bpy.types.Operator):
self.report({"INFO"}, "See system console for the results")
return {"FINISHED"}
class ToggleDetailedIOSLogs(bpy.types.Operator):
bl_idname = "bim.toggle_detailed_ios_logs"
bl_label = "Toggle Detailed IfcOpenShell Logs"
bl_options = {"REGISTER", "UNDO"}
bl_description = (
"Turn on detailed IfcOpenShell logs in the system console.\n"
+ "Could be useful debugging issues "
+ "loading IFC representations / serializing IFC geometry."
+ "\n\nALT+CLICK to disable the logs"
)
# NOTE: No idea if it's possible to check from Python
# whether detailed logs are currently enabled or not.
# Therefore we just distinguish between click
# and alt-click to allow enabling/disabling the logs.
turn_on_logs: bpy.props.BoolProperty(name="Turn On Logs", default=True, options={"SKIP_SAVE"})
def invoke(self, context, event):
if event.type == "LEFTMOUSE" and event.alt:
self.turn_on_logs = False
return self.execute(context)
def execute(self, context):
import ifcopenshell.ifcopenshell_wrapper as wrapper
if self.turn_on_logs:
wrapper.turn_on_detailed_logging()
self.report({"INFO"}, "Detailed IfcOpenShell logs turned on.")
else:
wrapper.turn_off_detailed_logging()
self.report({"INFO"}, "Detailed IfcOpenShell logs turned off.")
return {"FINISHED"}
@@ -75,6 +75,9 @@ class BIM_PT_debug(Panel):
row = layout.row()
row.operator("bim.debug_active_drawing")
row = layout.row()
row.operator("bim.toggle_detailed_ios_logs")
row = layout.split(factor=0.5, align=True)
row.operator("bim.create_shape_from_step_id").should_include_curves = False
row.operator("bim.create_shape_from_step_id", text="", icon="IPO_ELASTIC").should_include_curves = True