'******************************************************************* ' class_Snap '******************************************************************* '=================================================================== ' Test '=================================================================== Public Sub Test() Dim G As New Class_Arcmap_Graphic Dim P As IPoint If (Not G.FindLayer("mjroad")) Then MsgBox ("mjroad feature not found") Exit Sub End If ' ReadAllFeatures G ReadSelectedFeatures G ' ReadFeaturesByCriteria G ' ReadFeaturesByRange G End Sub '=================================================================== ' ReadAllFeaures '=================================================================== Private Sub ReadAllFeatures(G As Class_Arcmap_Graphic) G.Read OutputStats G, "Read All Features" End Sub '=================================================================== ' ReadSelectedFeaures '=================================================================== Private Sub ReadSelectedFeatures(G As Class_Arcmap_Graphic) G.SelectSelected OutputStats G, "Read Selected Features" End Sub '=================================================================== ' ReadFeauresByCriteria '=================================================================== Private Sub ReadFeaturesByCriteria(G As Class_Arcmap_Graphic) G.SelectByCriteria ("NAME = 'GRANT'") OutputStats G, "Read By Criteria" End Sub '=================================================================== ' ReadFeatureByRange '=================================================================== Private Sub ReadFeaturesByRange(G As Class_Arcmap_Graphic) Dim P As IPoint G.Read Set P = G.Point(1) x1 = P.x y1 = P.y x2 = x1 + 100 y2 = y1 + 100 G.SelectByRange x1, y1, x2, y2 G.Read OutputStats G, "Read By Range: " & Round(x1, 2) & " " & Round(y1, 2) & " " & Round(x2, 2) & " " & Round(y2, 3) End Sub '=================================================================== ' OutputStats '=================================================================== Private Sub OutputStats(G, name) Dim P As IPoint G.Read Set P = G.Point(1) text = name & vbCrLf & " RowCount = " & G.RowCount & " Number of Points in First Feature = " & G.PointCount & vbCrLf For i = 1 To G.PointCount Set P = G.Point(i) text = text & vbCrLf & i & ") " & Round(P.x, 4) & ", " & Round(P.y, 4) Next i MsgBox text End Sub