OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 18-11-2006, 02:16
thira
Guest
 
Posts: n/a
Default VBA Segment GetIntersections

Hello
I use CorelDRAW10 VBA and got problem with Function GetIntersections() with below sub() show that, if any Segment parallel with X-axis or Y-axis and intersection with a Shape, I can't use function GetIntersections to get intersection point. Please help.
Thanks,
Thira

Sub TestInterSec2()
Dim sh(3) As Shape, sg As Segment
Dim cps As CrossPoints, cp As CrossPoint
Dim TxT As String, i As Integer, CpCount As Integer
ActiveDocument.DrawingOriginX = -4.25
ActiveDocument.DrawingOriginY = -5.5
Set sh(1) = ActiveLayer.CreateRectangle(1.337224, 9.502106, 2.97122, 8.128602)
sh(1).ConvertToCurves
Set sh(2) = sh(1).Duplicate(0#, -1.94185)
sh(2).Rotate (15.363388)
Set sh(3) = ActiveLayer.CreateEllipse(1.360906, 5.642087, 3.136988, 3.866004)
sh(3).ConvertToCurves
Set sh(0) = ActiveLayer.CreateCurve
With sh(0).Curve.CreateSubPath(2.09502, 10.401988)
.AppendLineSegment False, 2.284469, 2.91876
End With
TxT = ""
For i = 1 To 3
Select Case i
Case 1
TxT = TxT & "Rectangle Curve Shape GetIntersections With Line Curve Shape:" & vbCrLf
Case 2
TxT = TxT & vbCrLf & vbCrLf & "Rotated Rectangle Curve Shape GetIntersections With Line Curve Shape:" & vbCrLf
Case 3
TxT = TxT & vbCrLf & vbCrLf & "Ellipse Curve Shape GetIntersections Witj Line Curve Shape:" & vbCrLf
End Select
For Each sg In sh(i).Curve.Segments
Set cps = sh(0).Curve.Nodes(2).Segment.GetIntersections(sg)
TxT = TxT & vbCrLf & "Segment#" & sg.Index & " have " & cps.Count & " CrossPoint(s)" & vbCrLf
CpCount = 0
For Each cp In cps
CpCount = CpCount + 1
TxT = TxT & "CrossPoint#" & CpCount & " is at " & _
Format(cp.PositionX, "###.###") & "," & _
Format(cp.PositionY, "###.###") & vbCrLf
Next cp
Next sg
Next i
MsgBox TxT
End Sub
Reply With Quote
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Where to begin with CorelDRAW and VBA shelbym CorelDRAW/Corel DESIGNER VBA 2 03-04-2007 09:15
delete vba project from cdr file hotairballoon CorelDRAW/Corel DESIGNER VBA 1 18-05-2005 09:08
CD 10, VBA not returning true outline width Webster CorelDRAW/Corel DESIGNER VBA 1 24-11-2004 17:09
VBA does not work with my CD 10 ! jobar CorelDRAW/Corel DESIGNER VBA 1 24-08-2003 12:38
Detect if VBA is installed (an answer and a question) reanan CorelDRAW/Corel DESIGNER VBA 3 04-12-2002 14:35


All times are GMT -5. The time now is 15:37.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com