Drawing Sectioned view graphics problem when automating it via VBA

Hello all,

So, I am creating a section view from front view using VBA macro. Its creating the section view alright as required, but the problem is, the 2nd segment of the section, is not displaying correctly, as if the second segment of the section line is not intersecting the model edge fully.
When I manually edit the sketch of the section line and move it just a little bit and then exit sketch by pressing ok the section view creates just fine.

So I am guessing it might be the graphics issue, or something else.
Here is my code for creating the sectioned view, and the resulting image as to what it creates.


  swModel.Extension.SelectByID2 nameLine2, "SKETCHSEGMENT", 0, 0, 0, False, 0, Nothing, 0
  swModel.Extension.SelectByID2 nameLine1, "SKETCHSEGMENT", 0, 0, 0, True, 0, Nothing, 0
  
  Dim displayDim As SldWorks.DisplayDimension
  Set displayDim = swModel.AddDimension2(3.85604601992988E-02, 0.3693582785302, 0)
  
  Dim dimName As String
  
  Set swAnnotaion = displayDim.GetAnnotation
  dimName = swAnnotaion.GetName
  
  'angle = 150
  angle = angle * (3.14159 / 180)
  
  Dim swDim As SldWorks.Dimension
  Set swDim = swModel.Parameter(dimName & "@" & sketchName) 'syntax for updating placed dimension e-g D1@Sketch3
  swDim.SystemValue = angle
  
  swModel.Extension.SelectByID2 nameLine2, "SKETCHSEGMENT", 0, 0, 0, False, 0, Nothing, 0
  swModel.Extension.SelectByID2 nameLine1, "SKETCHSEGMENT", 0, 0, 0, True, 0, Nothing, 0
  
  
 
  Set swView = swDrawing.CreateSectionViewAt5(0, 0, 0, "A", 1, Empty, 0)
  
  'flip section line
  swModel.Extension.SelectByID2 "Section Line1", "SECTIONLINE", 0, 0, 0, False, 0, Nothing, 0
  swDrawing.FlipSectionLine
  
  swModel.ForceRebuild3 False
  swModel.GraphicsRedraw2

 

 

See the encircle bit in the sectioned view. That's the problem and I cant figure out a way to eliminate that using API.

Any help would be very much appreciated.

Thank you