CODE to QUERY for ACTIVE MEASUREMENT TOOL . . .
2020-10-20-155950
All
This code will activate the LINE TOOL
'ACTIVATE THE LINE TOOL With Measure.Measurements.ToolsCommands.Line(Nothing) .Tool = eMMTool.Line .Interactive = False .Run(ThisApplication.ActiveDocument) End With
This code will activate the NO TOOL
'ACTIVATE THE NO TOOL TO DEACTIVATE ALL OTHER TOOLS With Measure.Measurements.ToolsCommands.Select(Nothing) .Tool = eMMTool.NoTool .Interactive = False .Run(ThisApplication.ActiveImage) End With
This code will activate the ANGLE TOOL
'ACTIVATE THE ANGLE TOOL With Measure.Measurements.ToolsCommands.Angle(Nothing) .Tool = eMMTool.Angle .Interactive = False .Run(ThisApplication.ActiveDocument) End With
I have poked around in the PROPERTIES and METHODS of
Measure.Measurements.ToolsCommands
and have not found something to give me info on which TOOL is active.
Is there CODE that will determine which TOOL is active?
Thanks.
-- Matt
0
Best Answers
-
Hi Matt,
Here is the code to get ActiveTool of the measurements:Public Sub PrintActiveTool Debug.Print ThisApplication.ActiveImage.MeasurementsData.ActiveTool End Sub
Regards,
Yuri0 -
Hi Matt,
Here is an example of using ENUM directly:Public Sub TestENUM Select Case ThisApplication.ActiveImage.MeasurementsData.ActiveTool Case McMeasurements.enumMMTools.mmtNoTool Debug.Print "NO TOOL" Case McMeasurements.enumMMTools.mmtLine Debug.Print "LINE TOOL" Case McMeasurements.enumMMTools.mmtAngle Debug.Print "ANGLE" End Select End Sub
Yuri0
Answers
Debug.Print ThisApplication.ActiveImage.MeasurementsData.ActiveTool
Debug.Print ThisApplication.ActiveImage.MeasurementsData.ActiveTool
ThisApplication.ActiveImage.MeasurementsData.ActiveTool
mmtAngle
mytest
10
As you found in the Help, ActiveTool is ENUM (McMeasurements.enumMMTools), so you should check it as ENUM, without converting it to string.
Yuri