2 Replies Latest reply on Jan 13, 2014 12:12 PM by Josh Brady

    Is there a way to multi select short edge faces

    James Lee

      Hi Guys,

       

      I have a part with alot of short edge faces and need to apply mesh control.

       

      Is there a way to multi select short edge faces that meets certain criteria for example if short edge is 0.2mm, it will selet the faces?

       

      I tried using power select tool but it does not have the function.

       

      Thanks in advance for the help.

       

      Regards,

      James

        • Re: Is there a way to multi select short edge faces
          Jared Conway

          no selection tools with that level of intelligence that i can think of

           

          you can try window selecting with edge selection filter enabled

           

          could body mesh control work?

           

          what is the cause of the short edges? can the geometry be cleaned up to remove them? could you post a screenshot of what it looks like?

          • Re: Is there a way to multi select short edge faces
            Josh Brady

            Here's a quick'n'dirty macro that'll do it:

             

            Dim swApp As SldWorks.SldWorks

            Dim swDoc As SldWorks.ModelDoc2

            Dim myPart As SldWorks.PartDoc

            Dim myBods As Variant

            Dim myFaces As Variant

            Dim myEdges As Variant

            Dim myBod As SldWorks.Body2

            Dim myFace As SldWorks.Face2

            Dim myEdge As SldWorks.Edge

            Dim myCurve As SldWorks.Curve

            Dim dStart As Double

            Dim dEnd As Double

            Dim bClosed As Boolean

            Dim bPeriodic As Boolean

            Dim i As Long

            Dim j As Long

            Dim k As Long

            Dim cLen As Double

            Dim MinEdge As Double

            Dim bGotParms As Boolean

            Sub main()

             

            Set swApp = Application.SldWorks

            Set swDoc = swApp.ActiveDoc

            If swDoc.GetType = swDocPART Then

                Set myPart = swDoc

            Else

                MsgBox "Parts only!"

                Exit Sub

            End If

             

            MinEdge = CDbl(InputBox("Enter minimum edge length in mm", "Select faces of small edges", "0.2"))

            MinEdge = MinEdge / 1000

             

            If MsgBox("Clear existing selections?", vbYesNo) = vbYes Then

                swDoc.ClearSelection2 True

            End If

             

            myBods = myPart.GetBodies2(swSolidBody, True)

            For i = 0 To UBound(myBods)

                Set myBod = myBods(i)

                myFaces = myBod.GetFaces

                For j = 0 To UBound(myFaces)

                    Set myFace = myFaces(j)

                    myEdges = myFace.GetEdges

                    For k = 0 To UBound(myEdges)

                        Set myEdge = myEdges(k)

                        Set myCurve = myEdge.GetCurve

                        bGotParms = myCurve.GetEndParams(dStart, dEnd, bClosed, bPeriodic)

                        cLen = myCurve.GetLength3(dStart, dEnd)

                        'Debug.Print bGotParms, dStart, dEnd, bClosed, bPeriodic, cLen

                        If cLen < MinEdge Then

                            myFace.Select4 True, Nothing

                            Exit For

                        End If

                    Next k

                Next j

            Next i

            End Sub