View Single Post
  #2  
Old 28-06-2017, 02:35
shark shark is offline
Senior Member
 
Join Date: Aug 2010
Location: Russia, Belgorod
Posts: 146
Default example from CorelDRAW VBA Help

Code:
Sub Test()
Dim sr As ShapeRange
Dim sp1 As SubPath, sp2 As SubPath
Dim cps As CrossPoints, cp As CrossPoint
Dim x As Double, y As Double, n As Long

 Set sr = ActiveSelectionRange
 If sr.Count <> 2 Then
    MsgBox "Please select two curves", vbCritical
    Exit Sub
 End If

 If sr(1).Type <> cdrCurveShape Or sr(2).Type <> cdrCurveShape Then
    MsgBox "One of the selected shapes is not a curve", vbCritical
    Exit Sub
 End If

 n = 0

 For Each sp1 In sr(1).Curve.Subpaths
  For Each sp2 In sr(2).Curve.Subpaths
   Set cps = sp1.GetIntersections(sp2)
   For Each cp In cps
    ActiveLayer.CreateEllipse2 cp.PositionX, cp.PositionY, 0.05
   Next cp
   n = n + cps.Count
  Next sp2
 Next sp1

 MsgBox n & " intersection point(s) found"
End Sub
Reply With Quote