Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.
so, what normally should function properly is doing strange things.
I can hide an entire pattern with :
Component.Visible("Pattern_Name") = False
normally all the components in the pattern also go invisible.
now i have a component that does not go invisible.
when i manually want to hide this component inventor says that i am overriding the representation of the component.
But this is very strange to me as i am not editing the component, just the assembly it is in.
so i don't know where this issue is coming from, and it doesn't make any sense to me.
No matter the representation active form a component, it should be possible to make it ivisible because this is not an edit to the component.
lately i am running into a lot of problems using pattern visibility with ilogic....
kind regards.
Hi Geert,
This will do the trick for a part feature pattern:
'Rectangular Pattern1
Dim a As Inventor.PartDocument = ThisDoc.Document
Dim b As Inventor.PartComponentDefinition = a.ComponentDefinition
b.Features.RectangularPatternFeatures.Item("Rectangular Pattern1").Suppressed = True
Regards,
Arthur Knoors
Regards,
Arthur Knoors
Autodesk Affiliations:
Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!
! For administrative reasons, please mark a "Solution as solved" when the issue is solved !
Hi Geert,
And this for the assembly component pattern:
Dim a As Inventor.AssemblyDocument = ThisAssembly.Document
Dim b As Inventor.AssemblyComponentDefinition = a.ComponentDefinition
b.OccurrencePatterns.Item("Component Pattern 1:1").Suppress(true)
Regards,
Arthur Knoors
Regards,
Arthur Knoors
Autodesk Affiliations:
Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!
! For administrative reasons, please mark a "Solution as solved" when the issue is solved !
the supress feature in assembly is the same as the ilogic code component,isactive("Pattern name") = false. right?
for now i fixed it by adding another function:
Function PatternElements(Name As String) Dim tdoc As Document = ThisDoc.Document Dim ocompdef As ComponentDefinition = tdoc.ComponentDefinition Dim oPattern As OccurrencePattern oPattern = ocompdef.occurrencepatterns.item(Name If oPattern.Visible = False Then For Each Element As OccurrencePatternElement In oPattern.OccurrencePatternElements For Each compocc As ComponentOccurrence In Element.Occurrences compocc.Visible = False Next Next End If End Function
but this still has me wondering why i need to update my component when i change something in de parent assembly...
Hi @GeertvanderHeide. Just in case you were not aware, there is actually a different iLogic shortcut snippet just for component patterns that you could try using, instead of the Component.IsActive or Component.Visible ones. The starter object is "Patterns" (represents IManagedPatterns), instead of "Component"/"Components". So the closes alternative iLogic snippet might look a bit like this:
Patterns.Item("Name").Pattern.Suppress
'or
Patterns.Item("Name").Pattern.Unsuppress
Patterns.Item("Name").Pattern.Visible = True
Wesley Crihfield
(Not an Autodesk Employee)
Here is a sub I made a week ago, it turns the occurrence off whether or not it is in a pattern.
I prefer using visibility and bomstructure reference instead of suppressing.
I think it turns of all elements in a pattern, i was too lazy to make it work for only the occurrence in question.
Sub Visibility(oOcc As ComponentOccurrence, boolvis As Boolean) If oOcc.IsPatternElement Then Dim oPattern As Inventor.OccurrencePattern = oOcc.PatternElement.Parent For Each oElem As Inventor.OccurrencePatternElement In oPattern.OccurrencePatternElements For Each Elemocc As ComponentOccurrence In oElem.Occurrences Elemocc.Visible = boolvis If boovis = True Then Elemocc.BOMStructure = BOMStructureEnum.kDefaultBOMStructure If boovis = False Then Elemocc.BOMStructure = BOMStructureEnum.kReferenceBOMStructure Next Next Else oOcc.Visible = boolvis If boovis = True Then oOcc.BOMStructure = BOMStructureEnum.kDefaultBOMStructure If boovis = False Then oOcc.BOMStructure = BOMStructureEnum.kReferenceBOMStructure End If End Sub
Might help, who knows
oke, so i did some manual testing, and did an interesting find.
apperantly the visibility of my pattern does work, but when i want to show the default representation for subassemblies, it turns on the visibility back on.
i do a loop for all occurrences and set the representation to 'default'. this is required because otherwise when i turn on subassemblies it automaticly sets the representation to 'master'..
how come the representation property is not stored while the visibility is off? i noticed this also happens when i do it by hand, so this is probably hard-coded inside inventor. but causes a lot of headaches...
Best to do the visibility in the document and not an assembly above it, then you turn of its proxy or something.
Do you have associative link on for that sub assembly?
Right click assembly and: Representation: Then checkbox Associative.
Sometimes in my assemblies with rules I also run a rule that turns on all sub assembly views on default and associative on true.
I would give you an example normally, but I gotta watch soccer
yeah i know how to set the default view representation 😉
Dim doc As AssemblyDocument = ThisDoc.Document Dim oAsmCompDef As ComponentDefinition oAsmCompDef = doc.ComponentDefinition Dim oCompOcc As Inventor.ComponentOccurrence For Each oCompOcc In oAsmCompDef.Occurrences If oCompOcc.DefinitionDocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then oCompOcc.SetDesignViewRepresentation("Default",, True) End If Next
sad thing is when i run this and it comes across invisible occurrences it also turns on the visibility.
i use it in a configuration model. first turn everything off, then turn required components on.
when i first set everything to default representation, then turn everything off, when it turn required items on they will be in master representation.
when i first turn off, then required on, then set everything to default representation, some nivisible components are visible again.
so in any direction this causes problems..
also still coming back coming back to my earlier point, how come visibility in a main assembly affects the representation in a subassembly? everytime i hide something, it also asks me if i want to override the associative representation, but i don't want to do that, i just want to hide the entire thing...
That's a good question to ask an Autodesk employee.
As a user it is weird, because you turn off the sub assembly, not the components underneath.
But subsequently all components in the subassembly will become invisible.
My guess its because of that subsequent action, not the main action. The way its programmed, and why its weird as user.
Would be helpful if that didn't happen though, hate it when associativity goes off.
One more thing to keep in mind when adding the associative representation rule is the order in which ilogic rules fire (top to botom)
I think in my last configurator, I added the representation rule to the top. Then fire all the visible/invisible rules and you are ok (Or representation rule at the bottom 😄 i forgot and its sunday)
haha i ussually put the representation rule at the bottom indeed.
maybe @johnsonshiue can share some wisdom about this?
Can't find what you're looking for? Ask the community or share your knowledge.