Message 1 of 2
How can find the min X of List of point2d?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I want to query and group some 2D points, such as find the maxmum X coordinate in the point, find the points with the maxmum X coordinate, but when I query with linq, the code error and cannot run.Can someone help me out? thanks!
The error message is as follows:
Conversion From Type 'GroupedResultEnumerable(Of Point2d,Double,VB$AnonymousType_0(Of Double,Double))' to type 'IWin32Window' is not valid.
the code is as follows:
Sub Main
Dim oTG As Inventor.TransientGeometry = ThisApplication.TransientGeometry
Dim oPt2d As New List(Of Point2d)
For i As Integer = 1 To 100
oPt2d.Add(oTG.CreatePoint2d(Int(99*Rnd)+1,Int(99*Rnd)+1))
Next
Dim oRad 'As Double
oRad=From oPt As Point2d In oPt2d.Cast(Of Point2d)
Group By oPt.X
Into oMax = Max(Abs(oPt.X))
MessageBox.Show(oRad, "Title")
Dim oMaxXPt2d As List(Of Point2d)
oMaxXPt2d=oPt2d.Cast(Of Point2d).Select(Function(p As Point2d) p.X=oRad).ToList
End Sub