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
  • One Start and End-Point of your Line strings are identical so they intersect you have to check yourself

    Regards

    Frank

    since 1985: GIS, CAD, Engineering (Civil)  Senior Consultant : [Autodesk Civil 3D , Esri ArcGIS, VertiGIS: in previous days : Bentley MS V4 - V8i, GeoGraphics, Bentley Map V8i, InRoads,  HHK Geograf, IBr DAVID] :  Dev: [C, C++, .NET, Java, SQL, FORTRAN, UML]
    [direct quote by: http://en.wikipedia.org/wiki/Helmut_Schmidt]: "Wer Kritik übel nimmt, hat etwas zu verbergen"
    Wer Grammatik- und/oder Rechtschreibfehler findet, der darf sie behalten :-)

  • No. If you zoom-in closer to that connected point, there is a gap of 0.000033m will be available. i.e. the two lines are not connected/intersected. Refer the attached screenshot for more details.

  • Unknown said:
    No. If you zoom-in closer to that connected point, there is a gap of 0.000033m will be available. i.e. the two lines are not connected/intersected. Refer the attached screenshot for more details.

    Sorry I just checked with a "0.0001" accuracy where I have a VBA that do so with this tolerance. Your talking about Meter 0.000033 !

    For the most of our mapping work that tolerance (0.0001m) is  what we like to archive.

    Think of the Float/double accuracy when developing.

    Regards

    Frank

    since 1985: GIS, CAD, Engineering (Civil)  Senior Consultant : [Autodesk Civil 3D , Esri ArcGIS, VertiGIS: in previous days : Bentley MS V4 - V8i, GeoGraphics, Bentley Map V8i, InRoads,  HHK Geograf, IBr DAVID] :  Dev: [C, C++, .NET, Java, SQL, FORTRAN, UML]
    [direct quote by: http://en.wikipedia.org/wiki/Helmut_Schmidt]: "Wer Kritik übel nimmt, hat etwas zu verbergen"
    Wer Grammatik- und/oder Rechtschreibfehler findet, der darf sie behalten :-)

  • It's ok. Is there anyother way to handle this kind of situation?

  • 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