AnsweredAssumed Answered

Help selecting Edges of a contour

Question asked by Prashant Mohan on Jun 26, 2017
Latest reply on Jan 13, 2018 by Prashant Mohan

I have code that gets the active sketch. It then gets all the contours of the sketch and selects one contour at a time. After that it gets all edges of each contour and loops through the edges and selects them. The sketch itself consists of bunch of rectangles.

Issue is when i select the contour it highlights the contour (of that rectangle) but when i select an edge it does not do the same neither does it give me any error. Any ideas or suggestion will be appreciated.

 

Dim vSkContours As Variant

Dim SelMgr As SldWorks.SelectionMgr

Dim mySelectData As SldWorks.SelectData

Dim swSelData As SldWorks.SelectData

Dim mySketch As SldWorks.Sketch

Dim skContour As SketchContour

Dim vEdges As Variant

Dim myEdge As SldWorks.Edge

Dim swEntity3 As SldWorks.Entity

Dim len1 As Integer, len2 As Integer, lenRe As Integer, counter As Integer

Dim feature As feature

 

 

 

 

Set SelMgr = Curr_Part.SelectionManager

Set mySelectData = SelMgr.CreateSelectData

Set mySketch = Curr_Part.GetActiveSketch2()

vSkContours = mySketch.GetSketchContours()

 

  If Not mySketch Is Nothing Then

 

        vSkContours = mySketch.GetSketchContours()

        contourCount = UBound(vSkContours) - LBound(vSkContours) + 1

      

        For i = LBound(vSkContours) To UBound(vSkContours)

            Set skContour = vSkContours(i)

          

             bRet = skContour.Select2(False, mySelectData)

          

            vEdges = skContour.GetEdges()

          

            len1 = 0

            If IsEmpty(vEdges) Then

 

 

                Debug.Print "    No edges."

 

 

            Else

          

               len1 = UBound(vEdges)

          

            End If

          

          

             For k = LBound(vEdges) To UBound(vEdges)

 

 

                Set myEdge = vEdges(k)

 

 

                If Not myEdge Is Nothing Then

              

                    Debug.Print "    Edge " & k & ": "

               

                    Set swEntity3 = myEdge

                    bRet = swEntity3.Select4(False, mySelectData)

 

 

                End If

 

 

            Next k

 

 

        Next i

    End If

 

 

Regards,

Prashant Mohan

Outcomes