- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Control LevelOfDetail with positions and Ilogic?
Hi everyone, I need help,
I have learn a little bit of ilogic by myself and I managed with the forum and googles help to write (or copy and modify bits and combine) some macros to make my life easier, but I am lost now.
I have been trying for a couple of days to link the position of my assemblies with the level of detail and I can't make it work.
I have several positions called LVL1, LVL2.... and so on and levels of detail called the same, the asembly moves to the LVL1 position and I am trying that the LevelOfDetail changes automatically accordingly but it seems just impossible.
I have been searching the forum and found some code, but nothing seems to work properly. (Some rules work, but the trigger does not)
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
If oAsmCompDef.RepresentationsManager.ActiveLevelOfDetailRepresentation.Name = "LVL1" Then
oAsmCompDef.RepresentationsManager.PositionalRepresentations.Item("LVL1").Activate
Else If oAsmCompDef.RepresentationsManager.ActiveLevelOfDetailRepresentation.Name = "LVL2" Then
oAsmCompDef.RepresentationsManager.PositionalRepresentations.Item("LVL2").Activate
Else If oAsmCompDef.RepresentationsManager.ActiveLevelOfDetailRepresentation.Name = "LVL3" Then
oAsmCompDef.RepresentationsManager.PositionalRepresentations.Item("LVL3").Activate
End If
Dim oAsmDoc As AssemblyDocument
oAsmDoc = ThisApplication.ActiveDocument
Dim oAsmDef As AssemblyComponentDefinition
oAsmDef = ThisApplication.ActiveDocument.ComponentDefinition
Dim oC As ComponentOccurrences
oC = oAsmDef.Occurrences
Dim oOcc As ComponentOccurrence
Dim pos As Integer
pos = 1
Dim oPosRep As PositionalRepresentation
oPosRep = oAsmDef.RepresentationsManager.PositionalRepresentations("LVL1")
For Each oOcc In oC
If pos = 1 Then
Call oPosRep.SetPositionalRepresentationOverride(oOcc, "LVL1")
pos = 0
Else
Call oPosRep.RemovePositionalRepresentationOverride(oOcc)
pos = 1
End If
Next
The first code works, (it does it's thing the other way round, I wish to activate the position to make the level of detail change, but I will be happy with that if there is no way to make it the other way) but it does not trigger automatically, I have to run the rule manually; I tried with events and nothing, then found something called "OnActivatePositionalRepresentation" wich seemed promising but I know very little of ilogic and it seems I cannot make it work.
The secong I didn't manage it to make it work at all but was somewhere in the forum as a solution...
Thanks to everyone, hope you can help me
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
You can likely make this work by having a local parameter in the assembly file trigger the rule to run. Events for these types of specific objects are rare and are difficult to achieve without going into to addin territory.
Steps to follow
1. Create a local parameter to store your options value.
2. Add this parameter to the rule and monitor it's status. As it is changes in the form this triggers the rule to run.
3. Change your code to activate the positional rep first then the level of detail.
A step I always do before hand is to ensure the exact workflow is achievable manually before attempting to write the steps to automate.
Or if this helped you, please, click (like)
Regards
Alan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Thanks @A.Acheson , I'll try and wether if I make it work or not, I'll post the followup