Hello, I managed to hide all the assembly parts in solidworks automatically using VB.net. but I found problems to display some parts to use them later.
I tried this code there
Sub ShowComp(swApp As SldWorks, swModel As ModelDoc2, swComp As Component2)
Dim vChildArr as Object
Dim vChild As Object
Dim swChildComp As Component2
Dim swComponentVisible As Integer = 1
swComp.Visible = swComponentVisible
vChildArr = swComp.GetChildren
For Each vChild In vChildArr
swChildComp = vChild
swChildComp.Visible = swComponentVisible
ShowComp(swApp, swModel, swChildComp)
Next vChild
End Sub
sub main ()
Dim vSelComp as Object
Dim swSelComp As Component2
Dim swApp As New SldWorks
Dim swModel As ModelDoc2
For Each vSelComp In vSelCompArr
swSelComp = vSelComp
ShowComp(swApp, swModel, swSelComp)
Next vSelComp
end sub
there is a problem with vSelComp, because the parts I have are in the form of strings, and swSelComp is Component2.
Do you have any idea how this problem can be solved? or do you have any other solution? and thank you