Measure tool - Add UI button to clear measurement from the screen

This commit is contained in:
Bruno Perdigão
2024-11-11 21:13:16 -03:00
parent d74a0d05fd
commit 204a1b1dc6
3 changed files with 20 additions and 0 deletions
@@ -44,6 +44,7 @@ classes = (
operator.LoadProject,
operator.LoadProjectElements,
operator.MeasureTool,
operator.ClearMeasurement,
operator.NewProject,
operator.QueryLinkedElement,
operator.RefreshClippingPlanes,
@@ -2492,3 +2492,20 @@ class MeasureTool(bpy.types.Operator, PolylineOperator):
def invoke(self, context, event):
super().invoke(context, event)
return {"RUNNING_MODAL"}
class ClearMeasurement(bpy.types.Operator):
bl_idname = "bim.clear_measurement"
bl_label = "Clear measurement from the screen"
bl_options = {"REGISTER", "UNDO"}
@classmethod
def poll(cls, context):
return len(context.scene.BIMPolylineProperties.measurement_polyline) > 0
def execute(self, context):
context.scene.BIMPolylineProperties.measurement_polyline.clear()
MeasureDecorator.uninstall()
tool.Blender.update_viewport()
return {"FINISHED"}
@@ -68,6 +68,8 @@ class ExploreTool(bpy.types.WorkSpaceTool):
op.hotkey = "S_M"
row = layout.row(align=True)
row.prop(prop, "measurement_type", text="Measure Type", expand=True, icon_only=True, emboss=True)
row = layout.row(align=True)
op = row.operator("bim.clear_measurement", text="", icon="X")
class ExploreHotkey(bpy.types.Operator):