Previous Document Next Document
Node.SubPathIndex

Property SubPathIndex As Long

Member of Node

The SubPathIndex property returns the index of the subpath within the Curve.Subpaths collection.

The SubPathIndex property returns a read-only value.

The following code example displays the number of nodes that are selected on a curve and the number of subpaths on which they reside. Before running this macro, you must use the Shape tool to select nodes.

Sub Test() 
 Dim nr As NodeRange 
 Dim n As Node 
 Dim spi As New Collection 
 Dim Found As Boolean 
 Dim idx As Variant 
 If ActiveShape Is Nothing Then 
  MsgBox "Nothing is selected." 
  Exit Sub 
 End If 
 If ActiveShape.Type <> cdrCurveShape Then 
  MsgBox "A curve must be selected." 
  Exit Sub 
 End If 
 Set nr = ActiveShape.Curve.Selection 
 If nr.Count = 0 Then 
  MsgBox "Please use the Shape tool to select several nodes." 
  Exit Sub 
 End If 
 For i = 1 To nr.Count 
  Set n = nr(i) 
  Found = False 
  For Each idx In spi 
   If n.SubPathIndex = idx Then 
    Found = True 
    Exit For 
   End If 
  Next idx 
  If Not Found Then spi.Add n.SubPathIndex 
 Next i 
 MsgBox "Selected " & nr.Count & " node(s) on " & spi.Count & " 
different subpath(s)" 
End Sub 

Previous Document Next Document Back to Top

Copyright 2007 Corel Corporation. All rights reserved.