Previous Document Next Document
SegmentRange.RemoveRange

Sub RemoveRange(SegmentRange As SegmentRange)

Member of SegmentRange

The RemoveRange method removes the segments in the specified range from the current range.

Parameters
Description
SegmentRange
Specifies the range of segments to be removed

The following code example creates a curve and two shape ranges. The first shape range contains all of the curve’s segments, and the second range contains only the curved segments of the curve. The second range is then removed from the first range, leaving only the line segments in the first range.

Sub Test() 
 Dim s As Shape 
 Dim n As Node 
 Dim sp As SubPath 
 Dim crv As Curve 
 Dim sg As Segment 
 Dim sgr As SegmentRange 
 Dim sgr2 As New SegmentRange 
 Set crv = CreateCurve(ActiveDocument) 
 ActiveDocument.ReferencePoint = cdrBottomLeft 
 Set sp = crv.CreateSubPath(-1, 0.2) 
 sp.AppendLineSegment 0.5, 1 
 sp.AppendCurveSegment 2, 3 
 sp.AppendCurveSegment 4, 1 
 sp.AppendCurveSegment 5, 4 
 sp.AppendCurveSegment 7, 2 
 sp.AppendLineSegment 8, 5 
 sp.AppendLineSegment 9, 1 
 Set s = ActiveLayer.CreateCurve(crv) 
 Set sgr = s.Curve.Segments.All 
 For Each sg In s.Curve.Segments 
  If sg.Type = cdrCurveSegment Then 
   sgr2.Add sg 
  End If 
 Next sg 
 sgr.RemoveRange sgr2 
End Sub 

Previous Document Next Document Back to Top

Copyright 2007 Corel Corporation. All rights reserved.