5 Replies Latest reply on Mar 6, 2015 11:25 AM by Keith Rice

    Get Sketch Segment name (vba)

    Sam Moss

      Hi,

      I'm new to the solidworks API, so am probably being stupid, at one point in my code I have a break for the user to select a line in a sketch. All I want to do with this at this point is get the name of the line (i.e. "line2"), nothing more complicated than that. However, I cannot find out how to do this, GetSelectedObject6 just returns not defined errors. HELP!

       

      Dim linename As String

          Dim swFeat As SldWorks.SketchSegment

       

          swFeat = Part.SelectionManager.GetSelectedObject6(1, -1)

          linename = swFeat.GetNameForSelection("LINE")

          Debug.Print linename

      This may be completely the wrong way to go about doing this, but any advice is appreciated