CODE to update MEASUREMENT DATA TABLE after FEATURE NAME CHANGE from CODE . . .
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.
I have found that if I CLOSE and OPEN the MEASUREMENT DATA TABLE, the REOPENED MEASUREMENT DATA TABLE presents the correct FEATURE NAME. Hopefully there is a better way to do this.
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
You can call
in the end of the macro to update image and data table.