1 Reply Latest reply on Mar 9, 2017 4:18 AM by Peter Brinkhuis

    Delete many components (C#)

    Bratitsa Vlaids

      Hi guys Help me please to understand. I use C# to develop software for solidworks.

      There are many lines as following. After each of them a component is selected and function EditDelete is called.


      DocumentExtension.SelectByID2("Name@" + NameDownPanel + "-1@" + AssemblyName, "FTRFOLDER", 0, 0, 0, false, 0, null, 0);



      What is the way to put each component to array so it is possible to delete them altogether? Should I use ISelectorMgr?

        • Re: Delete many components (C#)
          Peter Brinkhuis

          If you look at the help file for that function (SelectByID2), you'll see an append parameter, the 6th one. In your query it is set to false. If you set it to true you can append this selection to the list of selected items.


          If you know all of the names of the items you want to select, this method is fine. A more robust way would be to use the persistent ID for each feature. That will never change, even if the feature names does.