Previous Document Next Document

Object Model Reference : Classes : A : Application : Methods : Application.CreateSegmentRange


Application.CreateSegmentRange

Function CreateSegmentRange() As SegmentRange

Description

Member of Application

The CreateSegmentRange method creates an empty SegmentRange object.

VBA example

The following VBA example creates a curve, adds its segments to a segment range, and changes the segments in the range to line segments.

Sub Test()
 Dim s As Shape, sp As SubPath, crv As Curve
 Dim sr As SegmentRange
 Dim i As Integer
 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)
 Set sr = CreateSegmentRange
 For i = 1 To s.Curve.Segments.Count
  sr.Add s.Curve.Segments(i)
 Next i
 sr.SetType cdrLineSegment
End Sub

Previous Document Next Document Back to Top

Copyright 2013 Corel Corporation. All rights reserved.