Moin Moin,
Hab schon etwas gefunden...
Scheint nur so zu funktionieren!
Public text As String
Sub CATMain()
Dim partDocument1 As PartDocument
Set partDocument1 = CATIA.ActiveDocument
Dim sel1 As Selection
Set sel1 = partDocument1.Selection
sel1.Search ".Punkt.Sichtbarkeit=Sichtbar,all"
Dim shown, cnt As Long
Dim obj() As AnyObject
cnt = sel1.Count
ReDim obj(cnt)
shown = 0
For i = 1 To cnt
Set obj(i) = sel1.Item(i).Value
Next
text = ""
For i = 1 To cnt
If rekursiv(obj(i), partDocument1) Then
text = text & obj(i).Name & "," & Chr(10) & Chr(13)
shown = shown + 1
End If
Next
text = text & "werden angezeigt!"
text = text + Chr(10) + Chr(13) + Chr(10) + Chr(13)
text = text & shown & " Elemente sind Sichtbar"
MsgBox text
End Sub
Function rekursiv(o As AnyObject, opart As PartDocument)
If o.parent.Name = opart.Name Then
rekursiv = True
Exit Function
Else
Dim sel As Selection
Set sel = opart.Selection
sel.Clear
sel.Add o
Dim vis As VisPropertySet
Set vis = sel.VisProperties
Dim showstate As CatVisPropertyShow
vis.GetShow showstate
If (showstate = catVisPropertyShowAttr) Then
rekursiv = rekursiv(o.parent, opart)
Else
rekursive = False
End If
End If
End Function
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP