I would like to create a filter macro (In my company, all assemblies are composed on the same model). So I'd like to be able to create a macro that hides everything and displays only certain parts (based on the NAME of the file).
Also a macro that would redisplay everything..
Thank you.
[edit] The problem above all is to "parse" all the components in the assembly. Is there a way to do this in a for loop?
Hello, in the tutorials I posted on Lynkoa, there are one or two examples to go through all the components of an assembly. Otherwise, to filter, see the SolidWorks Advanced Selection.
It's true that it's impossible to find tutorials made by one person, sorry.
I was talking about this tutorial but in fact it concerns all the configurations of an assembly:
http://www.lynkoa.com/tutos/solidworks/macro-pour-toutes-les-configurations-d-un-assemblage-pour-activer-l-option-"promote"
I'm looking for the macro I did but it's not on Lynkoa.
I found something on the internet that allows me to browse the components of an assembly, the problem is that I can't hide them. What for?
Sub main() Dim swModel As ModelDoc2
Dim vComps as Variant Dim swComp As SldWorks.Component2 Dim swAssy As SldWorks.AssemblyDoc Dim i as Integer
Set swApp = Application.SldWorks Set swModel = swApp.ActiveDoc
If swModel.GetType = swDocASSEMBLY Then Set swAssy = swModel vComps = swAssy.GetComponents(False) For i = 0 TB UBound(vComps) Set swComp = vComps(i) Set swModel = swComp.GetModelDoc2 Debug.Print swModel.GetTitle swModel.HideComponent2 'Not working... swModel.ClearSelection2 True Next i End If End Sub