intersectwith method does not work with arc

intersectwith method does not work with arc

Anonymous
Not applicable
419 Views
1 Reply
Message 1 of 2

intersectwith method does not work with arc

Anonymous
Not applicable
hi,
i m trying to intersect line with an arc.it is not working.however it works with spline.

intpt = NextDimLine.IntersectWith(Ent, acExtendThisEntity)
Debug.Print LBound(intpt)
Debug.Print UBound(intpt)
NextDimLine.EndPoint = intpt

here Ent can be an arc or spline.finding intersection point is needed to extend line to that arc or spline.
The value for LBound(intpt) is 0 and UBound(intpt) is -1.why this happens?.line is in a position to extend to arc.
thank u.
0 Likes
420 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
Hai ,Try this it may help u


Sub Example_IntersectWith()
' This example creates a line and circle and finds the points at
' which they intersect.

' Create the line
Dim lineObj As AcadLine
Dim startPt(0 To 2) As Double
Dim endPt(0 To 2) As Double
startPt(0) = 1: startPt(1) = 1: startPt(2) = 0
endPt(0) = 5: endPt(1) = 5: endPt(2) = 0
Set lineObj = ThisDrawing.ModelSpace.AddLine(startPt, endPt)

' Create the circle
Dim circleObj As AcadCircle
Dim centerPt(0 To 2) As Double
Dim radius As Double
centerPt(0) = 3: centerPt(1) = 3: centerPt(2) = 0
radius = 1
Set circleObj = ThisDrawing.ModelSpace.AddCircle(centerPt, radius)
ZoomAll

' Find the intersection points between the line and the circle
Dim intPoints As Variant
intPoints = lineObj.IntersectWith(circleObj, acExtendNone)

' Print all the intersection points
Dim I As Integer, j As Integer, k As Integer
Dim str As String
If VarType(intPoints) <> vbEmpty Then
For I = LBound(intPoints) To UBound(intPoints)
str = "Intersection Point[" & k & "] is: " & intPoints(j) & "," & intPoints(j + 1) & "," & intPoints(j + 2)
MsgBox str, , "IntersectWith Example"
str = ""
I = I + 2
j = j + 3
k = k + 1
Next
End If
End Sub
0 Likes