Previous Document Next Document
CrossPoints.Count

Property Count As Long

Member of CrossPoints

The Count property returns the number of intersection points that are found. The value depends on the OffsetType parameter in the call to the GetIntersections method.

The Count property returns a read-only value.

The following code example creates two separate ellipses with the CreateEllipse method. The active document is cleared, both ellipses are added to the active selection, and the ellipses are combined to create a single shape object. The intersections, or CrossPoints, of this new shape are identified by creating small circles around each point, using its x- and y-coordinates to serve as the coordinates of the small circles. The number of crosspoints and the X position of the first crosspoint display in a message box.

Sub XPosition() 
 Dim s1 As Shape, s2 As Shape 
 Dim s As Shape 
 Dim cps As CrossPoints 
 Dim cp As CrossPoint 
 Set s1 = ActiveLayer.CreateEllipse(4, 2, 1, 0) 
 Set s2 = ActiveLayer.CreateEllipse(3, 1, 2, 5) 
 ActiveDocument.ClearSelection 
 s1.AddToSelection 
 s2.AddToSelection 
 ActiveSelection.Combine 
 Set s = ActiveSelection.Shapes(1) 
 Set cps = 
s.Curve.Subpaths(1).GetIntersections(s.Curve.Subpaths(2)) 
 MsgBox cps.Count 
 MsgBox cps.Item(1).PositionX 
End Sub 

Previous Document Next Document Back to Top

Copyright 2007 Corel Corporation. All rights reserved.