Hi,
Here's a slightly more sophisticated approach.
Note that when you select points with the GetPoint process you get a
variant, not a double array.
The ComparePoints function would need to be modified accordingly.
--
Laurie Comerford
CADApps
www.cadapps.com.au
Sub MyProgram()
Dim pt1(0 To 2) As Double
Dim pt2(0 To 2) As Double
..... Do something here
If ComparePoints(pt1, pt2, 0.0001) = True Then
.... Do something here
End If
..... Do something here
End Sub
Function ComparePoints(pt1() As Double, pt2() As Double, dTol As Double) As
Boolean
On Error GoTo ErrorHandler
Dim i As Integer
If LBound(pt1) <> LBound(pt2) And UBound(pt1) <> UBound(pt2) Then
MsgBox "Array definitions are not he same size. ComparePoints cannot
process them", vbInformation
ComparePoints = False
Exit Function
End If
For i = LBound(pt1) To UBound(pt1)
If Abs(pt1(i) - pt2(i)) > dTol Then
MsgBox "Difference between values is" & Format(Abs(pt1(0) - pt2(0)),
"0.000") & "for item " & i & " in the supplied points, vbInformation"
ComparePoints = False
Exit Function
End If
Next i
ComparePoints = True
Exit Function
ErrorHandler:
MsgBox "Unable to compare supplied data in 'ComparePoints' due to:" &
vbCrLf & _
Err.Description
ComparePoints = False
End Function ' ComparePoints
"Jeff Mishler" wrote in message
news:4864216@discussion.autodesk.com...
I don't know if this is the best way, but it works.
Dim ent1 As AcadEntity
Dim ent2 As AcadEntity
Dim pick As Variant
Dim ints As Variant
Dim stPt As Variant
Dim endPt As Variant
ThisDrawing.Utility.GetEntity ent1, pick, "Select line 1: "
ThisDrawing.Utility.GetEntity ent2, pick, "Select line 2: "
ints = ent1.IntersectWith(ent2, acExtendNone)
stPt = ent2.StartPoint
endPt = ent2.EndPoint
If ((ints(0) = stPt(0)) And (ints(1) = stPt(1)) And (ints(2) = stPt(2))) Or
_
((ints(0) = endPt(0)) And (ints(1) = endPt(1)) And (ints(2) = endPt(2)))
Then
Debug.Print "Found one!"
Else
Debug.Print "Nope!"
End If
wrote in message news:4864192@discussion.autodesk.com...
I want to know how to make this IF statement work. How would I rewrite it so
that the IF statement executes.
Is this a safe assumption?:
iPoint has an x, y, z value
oEnt2.startPoint has an x, y, z value
So even though they are different types, there must be a way to call the IF
statement and make the appropriate comparisons. Does anyone know how this
can be done?
Bernard