0 Replies Latest reply on Aug 30, 2013 9:38 AM by Chris Johnson

    Is it possible to select the longest edge in an array of edges?

    Chris Johnson

      Hi All,


      after sending the edges of a selected face to an array, is it possible to then select the longest edge in that array for the purposes of finding and saving its persistent ID for later use?


      if it is possible I would like to select the longest edge, save its ID and then do the same for the second longest edge.


         Select Longest edge.jpg


      Here is a snipet of the code that I do have working...but i have no idea if its possible to do what I want .




      'Select Surface-Cut1

              boolstatus = swModel.Extension.SelectByID2("SurfaceCut1", "BODYFEATURE", 0, 0, 0, False, 0, Nothing, 0)

          'Refine Selection to the face created by the Surface Cut (faces associated with specified feature)

                  Set swfeature = swSelMgr.GetSelectedObject6(1, -1)

                  vFaceArr = swfeature.GetFaces: If IsEmpty(vFaceArr) Then Exit Sub

                  For Each vFace In vFaceArr

                      Set swSelFace = vFace

                      Set swEntity = swSelFace

                      Set swFaceFeature = swSelFace.GetFeature

                      bRet = swEntity.Select4(True, swSelData)


          'Get edges of face and put them in an array

              If Not swSelFace Is Nothing Then 'Check if Face is Selected

              vLoops = swSelFace.GetLoops

              swModel.ClearSelection2 True

              For i = 0 To UBound(vLoops)

              Set swLoop = vLoops(i)

              If swLoop.IsOuter() Then

              vEdges = swLoop.GetEdges

              For j = 0 To UBound(vEdges)

              Set EdgeEntity = vEdges(j)

              EdgeEntity.Select4 True, Nothing


              End If


              End If



      OH, By the way...the purpose of this is to programatically select the specifed edges (one at a time) so that a chamfer may be applied to each of them individually.



      thanks for you help!