I have a bunch of vertical lines that I create based on some calculations I perform in a loop. In the loop after the calculations, I create a horizontal line and extend the newly created line to it. The problem that I am having is that some lines are extend to another horizontal line that I have but if I step through the code slowly, it works fine. Is there anyway to fix this and why does it do this? As you can see below, the 3rd vertical red line is extended past the short red horizontal line. There's a bit of code to check if my previous endpoint of the left vertical line is greater than the calculated y coordinate of the short horizontal line. If the test is positive, then the line is extended.
SplinePoints are y values of the short horizontal lines.
swPileSeg are the vertical red lines I select to extend.
Set swLine2 = swPileSeg(i)
Set endpointsTEST = swLine2.GetStartPoint2
If endpointsTEST.Y > SplinePoints(2 * i + 1) And endpointsTEST.Y <> SplinePoints(2 * i + 1) Then
swPileSeg(i).Select True
boolstatus = swSketchMgr.SketchExtend(0#, 0#, 0#)
End If