FindAllConnectingEdges Example

Land Auto

FindAllConnectingEdges Example

Sub Example_FindAllConnectingEdges()
    
    ' This example returns all the connecting edges for a given point
    ' in the first surface in the surface collection
    Dim surf As AeccSurface
    Set surf = AeccApplication.ActiveProject.Surfaces.Item(0)
    
    ' Get point for calculating connecting edges
    Dim pnt As Variant
    pnt = ThisDrawing.Utility.GetPoint(, "Select point in the surface: ")
    
    ' Get an actual surface point.
    pnt = surf.FindPoint(pnt(0), pnt(1))
    
    ' Get edge points
    Dim edgePnts As Variant
    edgePnts = surf.FindAllConnectingEdges(pnt(0), pnt(1))
    
    Dim lineObj As AcadLine
    Dim pnt1(0 To 2) As Double
    Dim pnt2(0 To 2) As Double
    Dim pnt3(0 To 2) As Double
    
    ' Draw red lines around first triangle definition
    pnt1(0) = edgePnts(0)
    pnt1(1) = edgePnts(1)
    pnt1(2) = edgePnts(2)
    pnt2(0) = edgePnts(3)
    pnt2(1) = edgePnts(4)
    pnt2(2) = edgePnts(5)
    pnt3(0) = edgePnts(6)
    pnt3(1) = edgePnts(7)
    pnt3(2) = edgePnts(8)
    Set lineObj = ThisDrawing.ModelSpace.AddLine(pnt1, pnt2)
    lineObj.Color = acRed
    Set lineObj = ThisDrawing.ModelSpace.AddLine(pnt2, pnt3)
    lineObj.Color = acRed
    Set lineObj = ThisDrawing.ModelSpace.AddLine(pnt3, pnt1)
    lineObj.Color = acRed
    
End Sub