2 Replies Latest reply on Aug 12, 2014 10:56 AM by Ar K
      • Re: Useing "Select Connected Faces" and "Invert Selection" by api
        Ar K

        I found this code for invert selection :

         

        swApp.RunCommand(swCommands_e.swCommands_InvertSelection, "")

        • Re: Useing "Select Connected Faces" and "Invert Selection" by api
          Ar K

          After selecting a face Use these :

           

          1-invert selection :

           

              (vba):  swApp.RunCommand swCommands_e.swCommands_InvertSelection, ""

              (vb.net):  swApp.RunCommand(swCommands_e.swCommands_InvertSelection, "")

           

          2- Select Connected Faces : (vb.net)

           

                  Dim swDoc As ModelDoc2 = Nothing

                  Dim swSelectionMgr As SelectionMgr

                  Dim objFace As Object

                  Dim swFace As Face2

                  Dim objEdges As Object

                  Dim swEdges() As Edge

                  Dim objAdjFace As Object

                  Dim swAdjFace(1) As Face2

                  Dim ent As Entity

           

                  swDoc = swApp.ActiveDoc

           

                  swSelectionMgr = swDoc.SelectionManager

                  objFace = swSelectionMgr.GetSelectedObject(1)

                  swFace = objFace

           

                  objEdges = swFace.GetEdges()

                  ReDim swEdges(UBound(objEdges))

                  For i As Int16 = 0 To UBound(objEdges)

                      swEdges(i) = objEdges(i)

                  Next

           

                  For j As Int16 = 0 To UBound(swEdges)

                      objAdjFace = swEdges(j).GetTwoAdjacentFaces2()

                      swAdjFace(0) = objAdjFace(0)

                      swAdjFace(1) = objAdjFace(1)

                      If Not swAdjFace(0).IsSame(swFace) Then

                          ent = swAdjFace(0)

                          ent.Select(True)

                      Else

                          ent = swAdjFace(1)

                          ent.Select(True)

                      End If

                  Next