API Documentation > CorelDRAW > 2025-v26 > SubPath > IVGSubPath
SubPath.GetSegmentAt method
Gets the segment at a given position
Syntax:
Function GetSegmentAt(Optional ByVal Offset As Double = 0.5, Optional ByVal OffsetType As cdrSegmentOffsetType = cdrRelativeSegmentOffset, Optional ByRef SegmentOffset As Double = 0) As Segment
Parameters:
Name Type Description
Offset
Double
Specifies, in document units, the offset of the point. 5.
OffsetType
Specifies the offset type, and returns cdrSegmentOffsetType.
SegmentOffset
Double
Specifies the offset of the subpath segment.
Remarks:
The GetSegmentAt method returns a segment that contains the specified point on a subpath. Optionally, it returns the offset of the specified point within the returned segment.
Examples:
The following VBA example converts, to a line, the segment that is in the middle of the subpath.
Sub Test()
Dim seg As Segment
Set seg = ActiveShape.Curve.Subpaths(1).GetSegmentAt(0.5, cdrRelativeSegmentOffset)
seg.Type = cdrLineSegment 
End Sub