Hi again Curtis.
I have now returned from my holiday and fiddeled with the code you send me.
But i must admit i cannot solve this by my self and i need your help again.
SyntaxEditor Code Snippet
If Vogn_Model="Vejle"Then
ThisApplication.ActiveDocument.ComponentDefinition.RepresentationsManager.LevelofDetailRepresentations("Vejle").Activate
iLogicVb.UpdateWhenDone=True
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
Dim oOccurrence As ComponentOccurrence
For Each oOccurrence In oAsmCompDef.Occurrences
If oOccurrence.Name.Contains("3699-2031.10") = True Then
oOccurrence.Definition.BOMStructure = 51971 'Phantom
End If
Next
For Each oOccurrence In oAsmCompDef.Occurrences
If oOccurrence.Name.Contains("3699-2031.11") = True Then
oOccurrence.Definition.BOMStructure = 51971 'Phantom
End If
Next
For Each oOccurrence In oAsmCompDef.Occurrences
If oOccurrence.Name.Contains("3699-2031.10 Vejle") = True Then
oOccurrence.Definition.BOMStructure = 51970 'Normal
End If
Next
For Each oOccurrence In oAsmCompDef.Occurrences
If oOccurrence.Name.Contains("3699-2031.11 Vejle") = True Then
oOccurrence.Definition.BOMStructure = 51970 'Normal
End If
Next
Else If Vogn_Model="Standard"Then
ThisApplication.ActiveDocument.ComponentDefinition.RepresentationsManager.LevelofDetailRepresentations("Standard").Activate
iLogicVb.UpdateWhenDone=True
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
Dim oOccurrence As ComponentOccurrence
For Each oOccurrence In oAsmCompDef.Occurrences
If oOccurrence.Name.Contains("3699-2031.10") = True Then
oOccurrence.Definition.BOMStructure = 51970 'Normal
End If
Next
For Each oOccurrence In oAsmCompDef.Occurrences
If oOccurrence.Name.Contains("3699-2031.11") = True Then
oOccurrence.Definition.BOMStructure = 51970 'Normal
End If
Next
For Each oOccurrence In oAsmCompDef.Occurrences
If oOccurrence.Name.Contains("3699-2031.10 Vejle") = True Then
oOccurrence.Definition.BOMStructure = 51971 'Phantom
End If
Next
For Each oOccurrence In oAsmCompDef.Occurrences
If oOccurrence.Name.Contains("3699-2031.11 Vejle") = True Then
oOccurrence.Definition.BOMStructure = 51971 'Phantom
End If
Next
End If
InventorVb.DocumentUpdate()
As you can see in the code i have posted, it looks like the last one i used, and everytime i try to input parts of the code you send me, i come up with errors or no change at all.
I would be much appreciated if you can solve this puzzle.
Wtih be regards, Mikael Nanke