My intention is to have a rule that will run through each pattern in an assembly containing a certain string value, and then suppress all it's components only when a certain level of detail is active. I've seen on these forums how to activate an LOD using iLogic, but I want the opposite where I get the LOD string value rather than set it.
When I change to a larger member in my iAssembly and then activate a level of detail suppressing all my Patterns for screws, inventor wont recognize the newly generated components within each pattern to need to be suppressed like the others. So far I have a rule written to find and suppress these pattern, but i dont know how to have the rule automiatically run ONLY IF the level of detail "Steel_Frame" is selected.
Where it says <Insert LOD Code> below is where I need to declare the Level of Detail and use an If statement on the whole thing to run only IF LOD = "Steel_Frame"
Dim oAsmCompDef As AssemblyComponentDefinition oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition '<Insert LOD Code> If LOD = "Steel_Frame" Then Dim oPattern As OccurrencePattern Dim oList As New ArrayList For Each oPattern In oAsmCompDef.OccurrencePatterns If oPattern.Name.Contains("Screw") Then Dim oElement As OccurrencePatternElement For Each oElement In oPattern.OccurrencePatternElements Dim oComp As ComponentOccurrence oComp = oElement.Occurrences.Item(1) oComp.Suppress Next End If Next End If
Solved! Go to Solution.
Solved by Curtis_Waguespack. Go to Solution.
Hi astarnes,
You can use the ActiveLevelOfDetailRepresentation property for this. Here's a quick example.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
'define document oDoc= ThisDoc.Document 'define LOD rep Dim oLODRep As LevelOfDetailRepresentation 'define rep manager Rep_Man =oDoc.ComponentDefinition.RepresentationsManager 'get active LOD oLODRep = Rep_Man.ActiveLevelOfDetailRepresentation MessageBox.Show("The Active LOD is called: " & oLODRep.Name, "iLogic")
Edit: Using what you already have with the component definition, this would work also:
'define the ComponentDefinition Dim oAsmCompDef As AssemblyComponentDefinition oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition 'define LOD rep Dim oLODRep As LevelOfDetailRepresentation 'define rep manager Rep_Man =oAsmCompDef.RepresentationsManager 'get active LOD oLODRep = Rep_Man.ActiveLevelOfDetailRepresentation MessageBox.Show("The Active LOD is called: " & oLODRep.Name, "iLogic")
Is there a good way to trigger a rule when you change the level of detail? I've tried using the parameter trigger (iTrigger0) and an event trigger (Any component change or suppression), and both seem to not trigger the rule. Currently I have it set to where it will trigger before saving.
Hi astarnes,
Unfortunately, I can't think of a way to do that based on the user switching LODs.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Thanks Curtis - I also found this code useful in some iLogic for inserting CoG work points for various levels of detail.