I personly hate 2dPolylines and the code shown is not a good introduction to vba.
If one is making a whole lot of polarpoints then they may as well be passed directly to the sub instead of doubling up on the code
Dim Ang As Double
Ang = MainAngle - (Pi / 2)
CLP1 = TDU.PolarPoint(M1, Ang, D1)
CLP2 = TDU.PolarPoint(M2, Ang, D1)
CLP3 = TDU.PolarPoint(M3, Ang, D1)
CLP4 = TDU.PolarPoint(M1, Ang, D2)
CLP5 = TDU.PolarPoint(M2, Ang, D2)
CLP6 = TDU.PolarPoint(M3, Ang, D2)
If ThisDrawing.IsSingleShade Then
If ThisDrawing.IsCS Then ' center support single shade
DrawCLines CLP1, CLP3, "Shade1"
DrawCLines CLP2, CLP3, "Shade1"
Else ' end condition single shade
DrawCLines CLP1, CLP2, "Shade1"
End If
Else
If ThisDrawing.IsCS Then ' center support double shade
DrawCLines CLP1, CLP3, "Shade1"
DrawCLines CLP2, CLP3, "Shade1"
DrawCLines CLP4, CLP6, "Shade2"
DrawCLines CLP5, CLP6, "Shade2"
Else ' end condition double shade
DrawCLines CLP1, CLP6, "Shade1"
DrawCLines CLP4, CLP5, "Shade2"
End If
End If
Private Sub DrawCLines(StartPoint As Variant, EndPoint As Variant, sLayer As String)
Dim Cline1 As AcadLWPolyline
Dim Pts(3) As Double
Pts(0) = StartPoint(0): Pts(1) = StartPoint(1)
Pts(2) = EndPoint(0): Pts(3) = EndPoint(1)
Set Cline1 = ThisDrawing.ModelSpace.AddLightWeightPolyline(Pts)
Cline1.Layer = sLayer
Cline1.color = acGreen
Cline1.Linetype = "CENTER"
End Sub