Sub SelectSimilar()
If CheckDoc(1) Then
'boostStart "Index"
ActiveWindow.ActiveView.Zoom = 256000
Dim S As Shape
Dim T As Shape
Dim SR As New ShapeRange
Dim TR As ShapeRange
Dim A As Long
Dim OurShape As Currency
Set T = ActiveSelectionRange.Shapes.First
SR.Add T
Set TR = ActivePage.Shapes.All
OurShape = SimilarityRating(T)
ReDim Catalogue(TR.Count + 1, 2) As Currency
For A = 1 To TR.Count
Set S = TR(A)
Catalogue(A, 1) = SimilarityRating(S)
Catalogue(A, 2) = S.StaticID
Debug.Print Catalogue(A, 1)
Next A
For A = 1 To TR.Count
If Catalogue(A, 1) = OurShape Then
Set S = ActivePage.FindShape(, , Catalogue(A, 2))
If S.SizeHeight > T.SizeHeight * 0.5 And S.SizeHeight < T.SizeHeight * 1.5 And T.SizeWidth > S.SizeWidth * 0.5 And T.SizeWidth < S.SizeWidth * 1.5 Then
SR.Add S
End If
End If
Next A
SR.CreateSelection
ActiveWindow.ActiveView.ToFitSelection
'boostFinish True
End If
End Sub
Function SimilarityRating(S As Shape) As Currency
Dim X As Double
Dim Y As Double
Dim Size As Double
Dim Steps As Double
Dim Gap As Double
Steps = 4
Dim Index As Currency
Dim A As Byte
Index = 0
A = 0
If S.SizeHeight > S.SizeWidth Then
Size = S.SizeHeight
Else
Size = S.SizeWidth
End If
Gap = Size / Steps
Size = Size - Gap
Gap = Size / Steps
For Y = 0 To Steps
For X = 0 To Steps
If S.IsOnShape((S.CenterX - Size / 2) + X * Gap, (S.CenterY - Size / 2) + Y * Gap, Gap * 0.5) Then
'Debug, can comment out
'ActiveLayer.CreateEllipse2 (S.CenterX - Size / 2) + X * Gap, (S.CenterY - Size / 2) + Y * Gap, Gap * 0.5
Index = Index + 2 ^ A
Else
'Debug, can comment out
'ActiveLayer.CreateEllipse2 (S.CenterX - Size / 2) + X * Gap, (S.CenterY - Size / 2) + Y * Gap, Gap / 8
End If
A = A + 1
Next X
Next Y
'Debug, can comment out
'ActiveLayer.CreateArtisticText S.LeftX, S.BottomY - 1, Index, , , , 32
SimilarityRating = Index
End Function