How to find a 'hidden' part in a directory tree
How to find a 'hidden' part in a directory tree
(OP)
In the past, I've always known which part I've hidden, and so I knew where to go in the assembly model tree, to 'show' my missing part. But now that I've inherited a few models, I don't know where, or even which parts are hidden.
Is there a way to display a list of hidden parts, or is there a way to show- all? Or how would someone else go about resolving my little problem?
Is there a way to display a list of hidden parts, or is there a way to show- all? Or how would someone else go about resolving my little problem?






RE: How to find a 'hidden' part in a directory tree
To show-all:-
Select (highlight) the Top Level assy in the FM, then Edit > Show (or Show with depepndants) then select the configuration option.
Helpful SW websites FAQ559-520
How to get answers to your SW questions FAQ559-1091
RE: How to find a 'hidden' part in a directory tree
Expanding the Display Pane from the FM tree makes it easier, IMO, to see what's hidden and what's not, but the FM tree will need to be fully expanded.
RE: How to find a 'hidden' part in a directory tree
Do you actually have Edit > Show with dependants? It was in SW2004, but didn't work (only Unsuppress with dependants worked). We never upgraded to SW2005. Now in SW2006, only Edit > Show is there. Do you see the same thing?
Ken
RE: How to find a 'hidden' part in a directory tree
There is a macro in the SW2006 API Help called "Make All Assembly Components Visible Example". There is also an macro for "Only Show Selected Components Example".
Both work great.
Ken
RE: How to find a 'hidden' part in a directory tree
http
Helpful SW websites FAQ559-520
How to get answers to your SW questions FAQ559-1091
RE: How to find a 'hidden' part in a directory tree
It is very useful to keep track of supressed or hided parts/subassemblies.
Just create a macro button in the excel sheet called "Assembly". Some words are in Portuguese but I think you can figure out the appropriate english words.
Dim ErroConf As Integer
Dim RootComponent As Object
Private Sub CommandButton1_Click()
Dim swApp As Object
Dim AssemblyDoc As Object
Dim Configuration As Object
Dim linha As Integer
Dim linhafim As Integer
Dim linhatab As Integer
Dim ConfNome As Variant
Dim nivel As Integer
Set swApp = CreateObject("SldWorks.Application")
Set AssemblyDoc = swApp.ActiveDoc
ErroConf = 0
'On Error GoTo erro1
Set Configuration = AssemblyDoc.GetActiveConfiguration()
Set RootComponent = Configuration.GetRootComponent()
ConfNome = Configuration.Name()
' novo método de limpeza da folha
Worksheets("assembly").Range("A1:IV65536").ClearContents
Worksheets("assembly").Select
If AssemblyDoc.GetType <> 2 Then
MsgBox "Por favor active uma Assembly no Solidworks"
Exit Sub
End If
Worksheets("assembly").Range("I2").Value = "EM EXECUÇÃO"
' títulos das colunas de dados dos componentes
linha = 4
Worksheets("assembly").Range("A" & linha).Value = "Nível"
Worksheets("assembly").Range("B" & linha).Value = "Componente"
Worksheets("assembly").Range("C" & linha).Value = "Config."
Worksheets("assembly").Range("D" & linha).Value = "Tipo"
Worksheets("assembly").Range("E" & linha).Value = "Supressão"
Worksheets("assembly").Range("F" & linha).Value = "Visibilidade"
Worksheets("assembly").Range("G" & linha).Value = "Montagem"
' análise recursiva dos componentes
If Not RootComponent Is Nothing Then
TraverseComponent 1, RootComponent
End If
' determina o comprimento dos dados
linha = 5
Do While (Worksheets("assembly").Cells(linha, 1).Value <> "")
linha = linha + 1
Loop
linhafim = linha
linha = 5
'fim de listagem
Worksheets("assembly").Range("I2").Value = ""
Worksheets("assembly").Cells(linhafim + 1, 1).Value = "FIM DE LISTAGEM"
Worksheets("assembly").Cells(linhafim + 2, 1).Value = "Total de " & (linhafim - 1) - linha + 1 & " componentes"
Worksheets("assembly").Cells(linhafim, 1).Select
If ErroConf = 1 Then MsgBox "ATENÇÃO!" & Chr$(13) & "Existem peças/conjuntos com configurações com o nome 'Default'." & Chr$(13) & "P.f. corrigir."
Exit Sub
erro1: MsgBox "Não é possível criar lista de peças. Verifique se:" & Chr$(13) & "1- a Assembly é válida" & Chr$(13) & "2- não é necessário um Rebuild" & Chr$(13) & "3- as propriedades de massa estão recalculadas"
Worksheets("assembly").Range("I2").Value = ""
End Sub
Private Function TraverseComponent(nivel As Integer, Component As Object)
Dim i As Integer
Dim Children As Variant
Dim Child As Object
Dim ChildCount As Integer
Dim ModelDoc As Object
Dim Subestrutura As String
Dim CompConf As Variant
' activa dados do componente
Set ModelDoc = Component.GetModelDoc()
' determina a configuração utilizada do componente
CompConf = Component.ReferencedConfiguration()
' escreve dados na lista de peças, se existirem
SubAddNameToSheet CompConf, nivel, Component
' verifica se o componente é um subconjunto e analisa recursivamente os "filhos"
Children = Component.GetChildren
ChildCount = UBound(Children) + 1
'análise recursiva dos subconjuntos
For i = 0 To (ChildCount - 1)
Set Child = Children(i)
Set ModelDoc = Child.GetModelDoc()
If Not ModelDoc Is Nothing Then Subestrutura = ModelDoc.GetTitle()
TraverseComponent nivel + 1, Child 'analisa recursivamente os "filhos"
Next i
End Function
Private Sub SubAddNameToSheet(ConfNome As Variant, nivel As Integer, componente As Object)
Dim colcontrol As Integer
Dim linha As Integer
Dim EstadoSupr As String
Dim Visibilidade As String
Dim Montagem As String
Dim ModelDoc As Object
Dim ModelType As String
Dim teste As Integer
Set ModelDoc = componente.GetModelDoc()
If Not ModelDoc Is Nothing Then
If ModelDoc.GetType = 2 Then
ModelType = "ASM"
Else
ModelType = "PRT"
End If
Else
ModelType = "?"
End If
linha = 5 ' 1ª linha de dados da lista de peças
colcontrol = 2 'coluna que controla a escrita de componentes
' detecção da linha livre para escrita de componentes
Do While (Worksheets("assembly").Cells(linha, colcontrol).Value <> "")
linha = linha + 1
Loop
'determina o estado de supressão
If componente.GetSuppression = 0 Then
EstadoSupr = "suprimido"
ElseIf componente.GetSuppression = 1 Then
EstadoSupr = "lightweigth"
ElseIf componente.GetSuppression = 2 Then
EstadoSupr = "OK"
Else
EstadoSupr = "indeterminado"
End If
'determina o estado de visibilidade
If componente.IsHidden(True) Then
Visibilidade = "escondido"
Else
Visibilidade = "OK"
End If
'determina o estado de montagem
If componente.GetConstrainedStatus = 1 Then
Montagem = "montagem incorrecta"
ElseIf componente.GetConstrainedStatus = 2 Or componente.GetConstrainedStatus = 0 Then
Montagem = "não montado"
ElseIf componente.GetConstrainedStatus = 3 Then
Montagem = "OK"
Else
Montagem = "hiper restringido"
End If
'escreve dados
Range("A" & linha).Select
ActiveCell.FormulaR1C1 = "" 'faz o scroll à folha à medida que escreve linhas
Worksheets("assembly").Cells(linha, 1).Value = nivel - 1 ' compatível com ProdStar
Worksheets("assembly").Cells(linha, 2).Value = componente.Name 'Model.GetTitle & ">" & ConfNome
Worksheets("assembly").Cells(linha, 3).Value = ConfNome
Worksheets("assembly").Cells(linha, 4).Value = ModelType
Worksheets("assembly").Cells(linha, 5).Value = EstadoSupr
Worksheets("assembly").Cells(linha, 6).Value = Visibilidade
Worksheets("assembly").Cells(linha, 7).Value = Montagem
End Sub