mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-28 19:27:10 +00:00
Measure tool - Add UI button to clear measurement from the screen
This commit is contained in:
@@ -44,6 +44,7 @@ classes = (
|
|||||||
operator.LoadProject,
|
operator.LoadProject,
|
||||||
operator.LoadProjectElements,
|
operator.LoadProjectElements,
|
||||||
operator.MeasureTool,
|
operator.MeasureTool,
|
||||||
|
operator.ClearMeasurement,
|
||||||
operator.NewProject,
|
operator.NewProject,
|
||||||
operator.QueryLinkedElement,
|
operator.QueryLinkedElement,
|
||||||
operator.RefreshClippingPlanes,
|
operator.RefreshClippingPlanes,
|
||||||
|
|||||||
@@ -2492,3 +2492,20 @@ class MeasureTool(bpy.types.Operator, PolylineOperator):
|
|||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
super().invoke(context, event)
|
super().invoke(context, event)
|
||||||
return {"RUNNING_MODAL"}
|
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"
|
op.hotkey = "S_M"
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
row.prop(prop, "measurement_type", text="Measure Type", expand=True, icon_only=True, emboss=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):
|
class ExploreHotkey(bpy.types.Operator):
|
||||||
|
|||||||
Reference in New Issue
Block a user