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
-
2020-10-21-100337Yuri --Super.I will use that to the APP later today.Thanks.-- Matt
0 -
2020-10-22-140845Yuri --Thank you for showing me
Debug.Print ThisApplication.ActiveImage.MeasurementsData.ActiveTool
I am working to add this to my code.I am having a difficult time working with the output of theDebug.Print ThisApplication.ActiveImage.MeasurementsData.ActiveTool
Sometimes it acts like a STRING and sometimes it acts like a VALUEDebug.Print _ Now() Debug.Print _ "ThisApplication.ActiveImage.MeasurementsData.ActiveTool" Debug.Print _ ThisApplication.ActiveImage.MeasurementsData.ActiveTool Dim mytest As String = _ ThisApplication.ActiveImage.MeasurementsData.ActiveTool Debug.Print "mytest" Debug.Print mytest
Produces:2020-10-22 14:15:47
ThisApplication.ActiveImage.MeasurementsData.ActiveTool
mmtAngle
mytest
10It seems that sometimes this acts like a STRING and sometimes it acts like a VALUE.I have found the TABLE in the HELP FILE that shows the VALUES and the NAMES below.Is there another method or property toThisApplication.ActiveImage.MeasurementsData.ActiveToolthat will give me either the MEMBER NAME or the VALUE without my having to setup a string to hold the value?Thanks.-- Matt
0 -
Hi Matt,
As you found in the Help, ActiveTool is ENUM (McMeasurements.enumMMTools), so you should check it as ENUM, without converting it to string.
Yuri
0 -
ADDENDUMI tried the following code
'UPDATE THE UI STATUS TEXT Select Case ThisApplication.ActiveImage.MeasurementsData.ActiveTool Case 0 label_StatusText.Text = "NO TOOL" Case 2 label_StatusText.Text = "LINE TOOL" Case 10 label_StatusText.Text = "ANGLE" End Select
and it works to do the job I need.I would have expected to need to usemmtNoToolmmtLinemmtAngleas the CASES but the VALUES worked.Any comments you can provide that would help me understand this would be appreciated.Thanks.
0 -
2020-10-23-074634Yuri --Thanks for the additional information.-- Matt
0
Categories
- All Categories
- 961 Image-Pro v9 and higher
- 9 Image-Pro FAQs
- 18 Image-Pro Download & Install
- 448 Image-Pro General Discussions
- 486 Image-Pro Automation (Macros, Apps, Reports)
- 20 AutoQuant Deconvolution
- 2 AutoQuant Download & Install
- 18 AutoQuant General Discussions
- 195 Image-Pro Plus v7 and lower
- 3 Image-Pro Plus Download & Install
- 106 Image-Pro Plus General Discussions
- 86 Image-Pro Plus Automation with Macros
- 19 Legacy Products
- 16 Image-Pro Premier 3D General Discussions
- 26 Image-Pro Insight General Discussions