Danke für den Tip, habe ich nun auch berücksichtigt.
Zum Test habe ich das ganze jetzt mal als VBA-Makro aufgebaut, damit ich das besser debuggen kann (wenns dann läuft, wird es ein Ilogic-Prog). Dabei konnte ich die oben genannten Probleme lösen, bis auf folgendes:
Wenn ich eine verbaute Komponente habe und dann mit
ucs.Visible() = False
die Sichtbarkeit des BKS ausstelle, wird mir das zwar im Lokalfenster vom VBA-Editor korrekt angezeigt (Eigenschaft visible wird von "wahr" auf "falsch" gesetzt), aber weder im Browser noch im Grafikfenster ändert sich was.
Kann das evtl. daran liegen, dass ich mich in einer Komponente befinde? Wenn ich die komplette Komponente ausblende funktioniert das nämlich auch im Browser und im Grafikfenster sofort.
Hier der aktuell VBA-Code:
Public Sub BAEausblenden()
Dim oapp As Application
Dim oasmDoc As AssemblyDocument
Dim oasmcomdef As AssemblyComponentDefinition
Dim osubasmcomdef As AssemblyComponentDefinition
Dim oparcomdef As PartComponentDefinition
Dim compoccs As ComponentOccurrences
Dim ocompOcc As ComponentOccurrence
'Dim ocompDoc As Document
Dim ucscol As UserCoordinateSystems
Dim waxcol As WorkAxes
Dim wplanescol As WorkPlanes
Dim ucs As UserCoordinateSystem
Dim waxis As WorkAxis
Dim wplane As WorkPlane
Set oasmDoc = ThisDocument
Set oasmcomdef = oasmDoc.ComponentDefinition
Set ucscol = oasmcomdef.UserCoordinateSystems
Set waxcol = oasmcomdef.WorkAxes
Set wplanescol = oasmcomdef.WorkPlanes
'Für diese Datei alles ausblenden
'Alle BKS ausblenden
For Each ucs In ucscol
ucs.Visible() = False
Next
'Alle Arbeitsachsen ausblenden
For Each waxis In waxcol
waxis.Visible() = False
Next
'Alle Arbeitsebenen ausblenden
For Each wplane In wplanescol
wplane.Visible() = False
Next
'Für alle verbauten Komponenten auch alle BAE ausblenden
Set compoccs = oasmcomdef.Occurrences
For Each ocompOcc In compoccs
MsgBox ocompOcc.Name
ocompOcc.Visible = True
If ocompOcc.DefinitionDocumentType = kAssemblyDocumentObject Then
Set osubasmcomdef = ocompOcc.Definition
Set ucscol = osubasmcomdef.UserCoordinateSystems
Set waxcol = osubasmcomdef.WorkAxes
Set wplanescol = osubasmcomdef.WorkPlanes
ElseIf ocompOcc.DefinitionDocumentType = kPartDocumentObject Then
Set oparcomdef = ocompOcc.Definition
Set ucscol = oparcomdef.UserCoordinateSystems
Set waxcol = oparcomdef.WorkAxes
Set wplanescol = oparcomdef.WorkPlanes
End If
MsgBox ocompOcc.Name 'Nur zum Test
''geht ab hier nicht:
'Alle BKS ausblenden
For Each ucs In ucscol
MsgBox ucs.Name 'Nur zum Test
If ucs.Visible() = True Then
ucs.Visible() = False
End If
Next
'Alle Arbeitsachsen ausblenden
For Each waxis In waxcol
If waxis.Visible() = True Then
waxis.Visible() = False
End If
Next
'Alle Arbeitsebenen ausblenden
For Each wplane In wplanescol
If wplane.Visible() = True Then
wplane.Visible() = False
End If
Next
Set oapp = ThisApplication 'Nur zum Test
oapp.ScreenUpdating = True 'Nur zum Test
Next
End Sub
------------------
Gruß
Michael
--->> Wissen ist Macht. Nichts wissen macht auch nichts. <<---
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP