iLogic code to synchronize view rep. with pos. rep of same name.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I found some code on this forum that works very well on a small test assembly.
When I use it on my larger target assembly it does not work under an iLogic trigger.
It does, however, work when the rule is run explicitly from the ilogic browser.
I have tried saving the rule under a new name directly in the assembly. It did not work, but I can run it explicitly and it works.
Any ideas?
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
If oAsmCompDef.RepresentationsManager.ActivePositionalRepresentation.Name = "Master"Then
'If the pos rep is the Master then activate the Default view rep
oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Item("Default").Activate
Else
Try
'Try to active a view rep with the same name as the active pos rep
'So if "two" is the current pos rep it will try to active the View rep "two"
oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Item(oAsmCompDef.RepresentationsManager.ActivePositionalRepresentation.Name).Activate
Catch
'If a view rep with the same name as the active pos rep doesn't exist set the default view rep active
oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Item("Default").Activate
End Try
End If