API Documentation > CorelDRAW > 2025-v26 > Curve > IVGCurve
Curve.CreateSubPathFromArray method
Adds a new subpath based on the node information specified
Syntax:
Function CreateSubPathFromArray(ByRef Source() As CurveElement, Optional ByVal Closed As Boolean = False, Optional ByVal NumElements As Long = -1) As SubPath
Parameters:
Name Type Description
Source
Closed
Boolean
Specifies whether the curve is closed, but does not automatically close the curve. The starting and ending nodes must have the same coordinates.
NumElements
Long
Specifies the number of valid curve elements to use. If nothing is specified, then all valid curve elements are used.
Remarks:
The CreateSubPathFromArray method adds a new subpath based on the properties of a specified node.
Examples:
The following VBA example creates a curve.
Sub Test()
Dim ce(5) As CurveElement
Dim crv As Curve
ce(0).ElementType = cdrElementStart
ce(0).PositionX = 0
ce(0).PositionY = 0
ce(1).ElementType = cdrElementLine
ce(1).NodeType = cdrSmoothNode
ce(1).PositionX = 1
ce(1).PositionY = 1
ce(2).ElementType = cdrElementControl
ce(2).PositionX = 2
ce(2).PositionY = 2
ce(3).ElementType = cdrElementControl
ce(3).PositionX = 3
ce(3).PositionY = 2
ce(4).ElementType = cdrElementCurve
ce(4).NodeType = cdrSmoothNode
ce(4).PositionX = 4
ce(4).PositionY = 1
ce(5).ElementType = cdrElementLine
ce(5).PositionX = 5
ce(5).PositionY = 0
Set crv = CreateCurve(ActiveDocument)
crv.CreateSubPathFromArray ce
ActiveLayer.CreateCurve crv 
End Sub