4 Replies Latest reply on Feb 10, 2016 1:53 AM by Divyanshu Bhardwaj

    API Get name of selection

    Vincent Pomerleau


      I created a user form that allow me to select entity(in my case edge, face or sketch segments) to do something else with a solidworks addin (camworks).

      All is working for now but I want to display the entity in the userform after I select it(example: 0,1@Sketch1, Face-87, Edge-67). Here a part of my code,can somebody help me?


      Public Sub OptionButton2_Click()

          Const MINSELECTIONS = 1

          If OptionButton2.Value = True Then OptionButton1.Value = False

          Call swModel.ClearSelection

          'SetForegroundWindow (hWndSolidWorks)


          While swSelMgr.GetSelectedObjectCount < MINSELECTIONS

              DoEvents   'Wait for user selection


          Set obj = swSelMgr.GetSelectedObject6(-1, 1)

          strtext = obj.GetNameForSelection(swSelEDGES) 'From here it doesnt work

          Debug.Print strtext

          'UserForm1.UpdateField (1)


      End Sub