Drawing the Outline of the Garden Path

The outline of the path can be drawn using the location and half width of the path acquired with the gpuser subroutine.

In this subroutine, the outline of the garden path is drawn based on the values obtained with the gpuser subroutine and stored in the global variables defined earlier.

  1. In the Code window, click after the End Sub statement of the gpuser subroutine and press Enter twice.
  2. Type the following code:
    ' Draw the outline of the path
    Private Sub drawout()
      ' Create an array of four 2D points
      Dim points(0 To 7) As Double
    
      Dim varRet As Variant
      
      ' Define the start point
      varRet = ThisDrawing.Utility.PolarPoint(sp, angm90, hwidth)
      points(0) = varRet(0)
      points(1) = varRet(1)
    
      ' Define the second point
      varRet = ThisDrawing.Utility.PolarPoint(varRet, pangle, plength)
      points(2) = varRet(0)
      points(3) = varRet(1)
    
      ' Define the third point
      varRet = ThisDrawing.Utility.PolarPoint(varRet, angp90, totalwidth)
      points(4) = varRet(0)
      points(5) = varRet(1)
    
      ' Define the fourth point
      varRet = ThisDrawing.Utility.PolarPoint(varRet, pangle + dtr(180), plength)
      points(6) = varRet(0)
      points(7) = varRet(1)
    
      ' Draw the outline of the garden path in Model space with a lightweight polyline
      Dim pline As AcadLWPolyline
      Set pline = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
      
      ' Close the polyline
      pline.Closed = True
    End Sub
  3. Save the project.