After merging objects, there are issues with GetFeaturePoints
My operation steps are roughly as follows:
Click on an object with the mouse and retrieve the relevant data of this object.
Version: Image Pro 10 10.0.14
I have a question. When I merge multiple objects, the resulting merged object will be assigned a new identification number.
Public Sub test If ThisApplication.Images.Count = 0 Then Exit Sub Dim im As McImage = ThisApplication.ActiveImage Dim dt As McMMData = im.MeasurementsData If dt.SubFeatures.Count = 0 Then Exit Sub Dim numpt As Integer = 0 Dim select_feat As McMMSubFeature Dim pt() As SINGLEPOINT If dt.SubFeatures.Count > 1 Then select_feat = select_object("Select Object", dt) MsgBox(select_feat.FeatureIndex.ToString()) End If ' Problem Here Get the number of points for the selected sub-feature numpt = dt.SubFeatures.Item(select_feat.FeatureIndex).GetFeatures.GetFeaturePoints(select_feat.FeatureIndex, pt) End Sub
' Function to select an object by clicking on the workspace Private Function select_object(prompt As String, md As McMMData) As McMMSubFeature Dim window1, doc1 Dim clickedPoint As System.Drawing.PointF Dim sf As McMMSubFeature With MediaCy.Automation.Application.WindowCommands.Active(Nothing) .Run(window1) End With With Automate.ScriptingCommands.ClickOnWorkspace(Nothing) .Prompt = prompt .SelectDocuments = True .Run(window1, doc1, Nothing) If .Status = McCommand.TaskStatus.IsProcessed Then For Each sf In md.SelectedSubFeatures Next End If End With Return sf End Function
1.before the merger,the index of this object is 12.
2.After merging, the index of this object will be the second group of classes
3.cause to get the wrong object.
numpt = dt.SubFeatures.Item(select_feat.FeatureIndex).GetFeatures.GetFeaturePoints(select_feat.FeatureIndex, pt)
How can I get the data of the selected object instead of just its index number?
Waiting for a response, thank you, everyone.