ds-blue-logo
Preview  |  SOLIDWORKS USER FORUM
Use your SOLIDWORKS ID or 3DEXPERIENCE ID to log in.
MCMark Coville11/07/2012

Hello,

Does anyone know how to modify this so that it selects all sub-assemblies as well. (Even sub-assemblies of the sub-assemblies) We are having an issue when we are ready to order equipment, some random components are set to "Exclude from BOM". I was hoping to use this macro to select everthing then change the component propertiesto include in BOM. If there is an easier way or a way to select everything that's set to "Exclude from BOM" I'd love to hear it.

Dim swApp As Object
Sub main()
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swAssy As SldWorks.AssemblyDoc
Dim swASC As SldWorks.AdvancedSelectionCriteria
Dim swSelMgr As SldWorks.SelectionMgr

Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swSelMgr = swModel.SelectionManager
Set swAssy = swModel
Set swASC = swAssy.GetAdvancedSelection
swASC.AddItem "Document name -- SW Special", SwConst.swAdvSelectType_Is_Not, "", False
swASC.Select
MsgBox swSelMgr.GetSelectedObjectCount
End Sub

Thanks,