Previous Document Next Document
Node.Previous

Function Previous() As Node

Member of Node

The Previous method returns the preceding node in the curve relative to the given node.

The following code example creates a curve with six segments, finds the first symmetrical node, and displays the index number of the node preceding the first symmetrical node:

Sub Test() 
 Dim s As Shape 
 Dim n As Node 
 Dim sp As SubPath 
 Dim crv As Curve 
 Set crv = CreateCurve(ActiveDocument) 
 ActiveDocument.ReferencePoint = cdrBottomLeft 
 Set sp = crv.CreateSubPath(1, 1) 
 sp.AppendLineSegment 1, 1 
 sp.AppendCurveSegment 3, 3 
 sp.AppendCurveSegment 5, 1 
 sp.AppendCurveSegment 6, 4 
 sp.AppendCurveSegment 8, 2 
 sp.AppendLineSegment 10, 5 
 sp.Nodes(2).Type = cdrSmoothNode 
 sp.Nodes(3).Type = cdrSmoothNode 
 sp.Nodes(4).Type = cdrSymmetricalNode 
 sp.Nodes(5).Type = cdrSmoothNode 
 Set s = ActiveLayer.CreateCurve(crv) 
 For Each n In s.Curve.Nodes 
  If n.Type = cdrSymmetricalNode Then 
   Set n = s.Curve.Nodes.Item(n.Index).Previous 
   Exit For 
  End If 
 Next n 
 MsgBox n.Index 
End Sub 

Previous Document Next Document Back to Top

Copyright 2007 Corel Corporation. All rights reserved.