Dim d As Double Dim l As Double Dim lineent1 As AcadLine Dim lineent2 As AcadLine Dim l1 As AcadLine Dim l2 As AcadLine For i = 0 To vliness.Count - 2 For Each lineent1 In allentss If (lineent1.StartPoint(0) = intPointarr(i) Or lineent1.EndPoint(0) = intPointarr(i)) And lineent1.StartPoint(1) = lineent1.EndPoint(1) And lineent1.StartPoint(1) < Centeryy Then Set l1 = lineent1 End If Next 'type mismatch ???? For Each lineent2 In allentss If (lineent2.StartPoint(0) = intPointarr(i) Or lineent2.EndPoint(0) = intPointarr(i)) And lineent2.StartPoint(1) = lineent2.EndPoint(1) And lineent2.StartPoint(1) > Centeryy Then Set l2 = lineent2 End If Next d = Sqr((l1.StartPoint(0) - l1.EndPoint(0)) ^ 2 + (l1.StartPoint(1) - l1.EndPoint(1)) ^ 2) l = Abs((l1.StartPoint(1) - Centeryy) * 2) Next