API Documentation > CorelDRAW > 2025-v26 > Segment > IVGSegment
Segment.SubPathIndex property
Gets the index of the segment's subpath within the curve
Syntax:
Property Get SubPathIndex() As Long
Remarks:
The SubPathIndex property returns the index value of the subpath to which the current segment belongs.
Examples:
The following VBA example re-creates each segment of the selected curve as a separate shape and gives each one a different outline color (depending on the subpath to which the original segment belonged).
Sub Test()
Dim s As Shape
Dim seg As Segment
If ActiveShape Is Nothing Then Exit Sub
  If ActiveShape.Type <> cdrCurveShape Then Exit Sub

 For Each seg In ActiveShape.Curve.Segments


Select Case seg.Type


  Case cdrLineSegment



 Set s = ActiveLayer.CreateLineSegment(seg.StartNode.PositionX, seg.StartNode.PositionY, _




seg.EndNode.PositionX, seg.EndNode.PositionY)


  Case cdrCurveSegment



 Set s = ActiveLayer.CreateCurveSegment(seg.StartNode.PositionX, seg.StartNode.PositionY, _




seg.EndNode.PositionX, seg.EndNode.PositionY, seg.StartingControlPointLength, _




seg.StartingControlPointAngle, seg.EndingControlPointLength, seg.EndingControlPointAngle)


End Select


s.Outline.Color = ActivePalette.Color(seg.SubPathIndex + 12)

 Next seg
  
End Sub