Object Model Reference : Classes : L : Layer : Methods : Layer.CreateCurve |
Function CreateCurve(Source As Curve) As Shape
Member of Layer
The CreateCurve method creates a curve at a specified location on a layer. You can use this method after you have created an empty curve and have appended segments to it.
• |
See the Application.CreateCurve method to create a curve in memory.
|
The following VBA example creates a curve on the active layer.
Sub Test() |
Dim crv As New Curve |
Dim s As Shape |
Dim sp As SubPath |
Set crv = Application.CreateCurve(ActiveDocument) |
Set sp = crv.CreateSubPath(1, 5) |
sp.AppendLineSegment 2, 0 |
sp.AppendCurveSegment2 5, 7, 6, 6, 3, 5 |
sp.AppendCurveSegment2 7, 2, 3, 6, 7, 1 |
sp.AppendLineSegment 9, 6 |
sp.Nodes(3).Type = cdrSmoothNode |
Set s = ActiveLayer.CreateCurve(crv) |
End Sub |
The following VBA example creates a puzzle piece:
Sub Test() |
Dim s As Shape, sp As SubPath, crv As Curve |
Set crv = Application.CreateCurve(ActiveDocument) |
Set sp = crv.CreateSubPath(1.351, 8.545) |
sp.AppendCurveSegment 1.351, 8.926, 0.127, 89.901, 0.127, -64.56 |
sp.AppendCurveSegment 1.156, 8.952, 0.066, 115.44, 0.066, -48.906 |
sp.AppendCurveSegment 1.156, 9.15, 0.065, 131.09, 0.065, -133.149 |
sp.AppendCurveSegment 1.351, 9.163, 0.065, 46.846, 0.065, -116.315 |
sp.AppendCurveSegment 1.351, 9.545, 0.127, 63.683, 0.127, -89.902 |
sp.AppendCurveSegment 0.976, 9.545, 0.125, 179.951, 0.125, 25.612 |
sp.AppendCurveSegment 0.96, 9.342, 0.063, -154.391, 0.063, 40.943 |
sp.AppendCurveSegment 0.767, 9.339, 0.067, -139.06, 0.067, -41.987 |
sp.AppendCurveSegment 0.752, 9.547, 0.063, 138.014, 0.065, -33.906 |
sp.AppendCurveSegment 0.351, 9.545, 0.134, 146.087, 0.134, 0.045 |
sp.AppendCurveSegment 0.351, 9.163, 0.127, -90#, 0.127, 63.681 |
sp.AppendCurveSegment 0.156, 9.15, 0.065, -116.317, 0.065, 46.846 |
sp.AppendCurveSegment 0.156, 8.952, 0.065, -133.152, 0.065, 131.093 |
sp.AppendCurveSegment 0.351, 8.926, 0.066, -48.906, 0.066, 115.439 |
sp.AppendCurveSegment 0.351, 8.545, 0.127, -64.561, 0.127, 90# |
sp.AppendCurveSegment 0.752, 8.547, 0.134, 0.002, 0.134, 146.087 |
sp.AppendCurveSegment 0.767, 8.339, 0.065, -33.908, 0.063, 138.012 |
sp.AppendCurveSegment 0.96, 8.342, 0.067, -41.987, 0.067, -139.058 |
sp.AppendCurveSegment 0.976, 8.545, 0.063, 40.943, 0.063, -154.388 |
sp.AppendCurveSegment 1.351, 8.545, 0.125, 25.613, 0.125, 179.998 |
sp.Closed = True |
Set s = ActiveLayer.CreateCurve(crv) |
End Sub |
Copyright 2013 Corel Corporation. All rights reserved.