Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

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