How to select all connected entities inside a sketch?

By Philippe Leefsma

Here is a question once posted by one of our ADN member:

Do you have an example on how to retrieve easily all connected entities given an initial sketch curve?

Solution

There isn’t a direct API for that, however the PartFeatures.CreatePath method can be used for that purpose:

 

      Public Sub GetPath(ByVal app As Inventor.Application)

 

        Dim doc As PartDocument

        doc = app.ActiveDocument

 

        Dim sketchEnt As SketchEntity

        sketchEnt = app.CommandManager.Pick( _

            SelectionFilterEnum.kSketchCurveFilter, _

            "Select curve:")

 

        Dim path As Path

        path = doc.ComponentDefinition.Features.CreatePath(sketchEnt)

 

        Dim pathEnt As PathEntity

        For Each pathEnt In path

 

            Call doc.SelectSet.Select(pathEnt.SketchEntity)

 

        Next

 

    End Sub

<

p style=”line-height: normal;margin: 0in 0in 0pt” class=”MsoNormal”> 


Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading