Previous Document Next Document
Node.Delete

Sub Delete()

Member of Node

The Delete method breaks a subpath at the specified node by removing a node from a curve.

  • If you delete a node from a segment that contains two nodes, the whole segment is removed.

The following code example deletes all cusp nodes in the curve:

Sub Test() 
 Dim s As Shape 
 Dim n As Node 
 Dim i As Long, Num As Long 
 Set s = ActiveShape 
 If s.Type <> cdrCurveShape Then Exit Sub 
 Num = s.Curve.Nodes.Count 
 i = 1 
 While i <= Num 
  Set n = s.Curve.Nodes(i) 
  If n.Type = cdrCuspNode Then 
   If n.SubPath.Nodes.Count = 2 Then 
    ' Deleting a node from a segment containing only 2 nodes 
    ' will remove the whole segment. If we are deleting the last 
    ' node of the subpath, then we must move one more step back. 
    If n.SubPath.EndNode Is n Then i = i - 1 
    n.Delete 
    Num = Num - 2 
    i = i - 1 
   Else 
    ' Just delete the node and adjust the number of nodes left. 
    n.Delete 
    Num = Num - 1 
    i = i - 1 
   End If 
  End If 
  i = i + 1 
 Wend 
End Sub 

Previous Document Next Document Back to Top

Copyright 2007 Corel Corporation. All rights reserved.