How to delete or clear selectionbox items?which api can support it?
right click in the selection box,delete or clear selection. whether you mean this?
Just a guess on my part..
Use the selectionmanager to get all the selections in the box (by mark) and then deselect them directly
2018 SOLIDWORKS API Help - ISelectionMgr Interface Members
If that doesn't work the help file states that 2018 SOLIDWORKS API Help - DeSelectByID Method (IModelDoc2) works when a property page is open.
Sorry I don't know if this works but it's what I'd try.. or wait for an answer from an expert
What do you mean by : "clear selectionbox items" are you talking about a box in a property manager ? if that's the case, I don't know how to do it.
if not, you need to use ClearSelection2 Method from IModelDoc2. 2019 SOLIDWORKS API Help - ClearSelection2 Method (IModelDoc2)
I have found the way to do it.
here is code:=========================================
selectionBox.SetSelectionFocus(); selectionBox.SetSelectedItem((short)itemIndex, true); ModelDoc2 swModel = swApp.ActiveDoc; SelectionMgr swSelMgr = swModel.SelectionManager; int selectionIndex = selectionBox.SelectionIndex[itemIndex]; swSelMgr.DeSelect(selectionIndex);
Ah you're in a property manager page.
Retrieving data ...