I made a small macro to exclude all the selected parts from the nomenclature. (via Record Mode)
The only problem is that the macro acts on all the other options in the same group (group5 in red below).
Here's the code (if I remember correctly I had to delete a line with a part name)
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
boolstatus = Part.CompConfigProperties5(2, 0, True, True, "Défaut<Brut d'usinage>", True, False)
boolstatus = Part.EditRebuild3()
End Sub
So you want to select parts and run the macro so that those parts are excluded from the BOM?
"So question: can we only act on exclude from the nomenclature?? "
-> Want to know if you can change the properties of the component without changing the other settings?
If this is the case, I propose the following modification, which retrieves the information of the selected entity and adds this information to the CompConfigProperties function in order to modify only the exclusion of the nomenclature.
It's up to you to see if it works the way you want it to.
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swSelectionMgr As SldWorks.SelectionMgr
Dim swEntity As SldWorks.Entity
Dim swComponent As SldWorks.Component2
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swSelectionMgr = swModel.SelectionManager
Set swEntity = swSelectionMgr.GetSelectedObject6(1, -1)
Set swComponent = swEntity.GetComponent
boolstatus = swModel.CompConfigProperties5(swComponent.GetSuppression, swComponent.Solving, swComponent.Visible, True, swComponent.ReferencedConfiguration, True, swComponent.IsEnvelope)
boolstatus = swModel.EditRebuild3()
End Sub
Logically the 2nd solution would be the right one to see how to use it in the macro as it should be. Even if the 1st is another viable solution.
Let's say that my current macro works since 90% of my parts are designed the same way.
But in case for the parts where I put several configurations, it changes me in my assembly these parts in the 1st configuration (default) and suddenly breaks the assembly (just re-select the right configuration).
Otherwise, the other solution is to select the rows to be excluded from the nomenclature table.
You can also try a program that I made available in the tutorials, it's HERE, it's written in C# but it's also doable in VBA and I use the "ExcludeFromBOM" function in it.