GetIntersectionPoints method

I am using (LineElement.)getIntersectionPoints method to find the number of intersection points between two specific line elements. In some case, there is no intersection between the lines. But the getintersectionPoints method returns a intersection point. Sample DGN is attached and the sample code is given below for your reference. How to solve this issue?

Option Explicit

Public Sub test()
Dim eleEn As ElementEnumerator
Dim ele1 As LineElement
Dim ele2 As LineElement
Dim intersectPts() As Point3d

Set eleEn = ActiveModelReference.GetSelectedElements
eleEn.MoveNext
Set ele1 = eleEn.Current
eleEn.MoveNext
Set ele2 = eleEn.Current
intersectPts = ele1.GetIntersectionPoints(ele2, Matrix3dIdentity)
Debug.Print UBound(intersectPts)
End Sub

intersectSample.dgn
Parents Reply Children
  • Unknown said:
    Is there any other way to handle this kind of situation?

    That depends on your 'situation'.  What exactly do you want to resolve?

    The VBA GetIntersectionPoints Method is probably a wrapper around the MDL mdlIntersect_allBetweenElms, which takes a tolerance value as its last argument.  VBA presumably assigns a reasonable default tolerance for you.

    Here's the VBA declaration of that function, should you want to venture down that road...

    Declare Function mdlIntersect_allBetweenElms Lib "stdmdlbltin.dll" ( _
      ByRef isPnt1 As Point3d , _
      ByRef isPnt2 As Point3d , _
      ByVal isPntSize As Long , _
      ByVal edP1 As Long , _
      ByVal edP2 As Long , _
      ByRef rotMatrix As Matrix3d , _
      ByVal tolerance As Double ) As Long

     
    Regards, Jon Summers
    LA Solutions