CODE to update MEASUREMENT DATA TABLE after FEATURE NAME CHANGE from CODE . . .
2020-10-16-172355
All --
I am working on an app that collects 8 line measurements from an image.
The line are collected in a certain order.
I would like the CODE to be able to modify the FEATURE NAME in the MEASUREMENT DATA TABLE so that the IMAGE-PRO FEATURE NAME matches the user's name for the same line.
I have gotten the CODE to where everything seems to be working but it seems that the MEASUREMENT DATA TABLE needs REFRESH that I do not seem to be able to trigger.
The CODE that I am working with to debug this feature is below.
Here is what I have after that CODE is run.

This illustrates that the FEATURE NAME has been changed but that this is not showing in the MEASUREMENT DATA TABLE.
Is there a command that will update the MEASUREMENT DATA TABLE?
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Public Function MMBTester01()
Dim docAA
With Application.DocumentCommands.Active(Nothing)
.Run(docAA)
End With
'Debug.print "Connect with the active image
Dim im As McImage = _
ThisApplication.ActiveImage
'Debug.print "Error trap for no image
If im Is Nothing _
Then
GoTo ENDER
End If
'Connect with the MEASUREMENT DATA in the ACTIVE IMAGE
Dim md As McMMData = _
im.MeasurementsData
'ERROR TRAP for NO FEATURES
If md.rows = 0 _
Then
GoTo ENDER
End If
Debug.Print AlcesNow
Debug.Print "md.rows"
Debug.Print md.rows
'Connect with the data for this image count
Dim MyData As McMMData
With measure.MeasurementsCommands.GetData(Nothing)
.Run(docAA, MyData)
End With
'Loop through the features found in the current image document
Dim MyI As Integer
For MyI = 0 To MyData.Rows-1
'Learn about the data for feature i
Dim MyFeature As McMMSubFeature = _
MyData.SubFeature(MyI)
'Learn the CLASS NAME for the CURRENT FEATURE
Dim My_FeatureClassName = _
MyFeature.Value(eMeasures.AnyClassName)
'Debug.print "My_FeatureClassName"
'Debug.print My_FeatureClassName
'Learn the FEATURE NAME for the CURRENT FEATURE
Dim My_FeatureName = _
MyFeature.Name
Debug.Print "My_FeatureName"
Debug.Print My_FeatureName
MyFeature.Name = _
MyFeature.Name & "AAA"
MyFeature.Refresh
Next
' 'Trigger an update of the dialog box
' System.Windows.Forms.Application.DoEvents()
' With Measure.Measurements.Gadgets.DataTable(Nothing)
' .CheckState = MediaCy.IQL.Application.McCommand.mcCheckState.Checked
' .Run()
' 'get panel name
' panelName =.PanelName
' .
' End With
'Refresh the window
ThisApplication.ActiveWindowEx.Refresh
ENDER:
End Function
0
Answers
-
Matt,
You can callMyData.BeginUpdateBlock(False)
in the end of the macro to update image and data table.
Yuri0 -
2020-10-17-191029Yuri --I implemented your suggestion and it worked like a champ.The IMAGE and the MEASUREMENT DATA TABLE now match after MMBTester01 runs.Now I can wire this technology into the APP.Thanks again.-- 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

