02-11-2021
05:34 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
02-11-2021
05:34 AM
Ok got it nearly.
If I check is the current LOD is active (which is not the case, if there have been changes to unsaved doc), then i can set the default LOD before doing what i need, and thereby not getting an error.
But I would prefer to let the user save the current LOD if it has not been created yet.
Dim asDoc As AssemblyDocument = ThisDoc.Document aComp = asDoc.ComponentDefinition 'Position der Detailgenauigkeit erfassen Dim ActLOD As String = aComp.RepresentationsManager.ActiveLevelOfDetailRepresentation.Name If Not aComp.RepresentationsManager.LevelOfDetailRepresentations.Item(ActLOD).Activate(True) Then ' MsgBox("Konnte gesetzt werden") 'Detailgenauigkeit speichern? ActLOD = "Hauptansicht" aComp.RepresentationsManager.LevelOfDetailRepresentations.Item(ActLOD).Activate(True) End If Try aComp.RepresentationsManager.LevelOfDetailRepresentations.Item("My LOD").Activate(True) Catch aComp.RepresentationsManager.LevelOfDetailRepresentations.Add("My LOD") aComp.RepresentationsManager.LevelOfDetailRepresentations.Item("My LOD").Activate(True) End Try