I'm trying to suppress the second element of a sub-pattern using ilogic without generating a LOD
i can do it manualy like this:
but i need to do it with i logic because of an automated frame I'm doing
I tried using this without success:
Dim oDoc As AssemblyDocument oDoc = ThisApplication.ActiveDocument 'reference the pattern in the assembly Dim oPattern As OccurrencePattern
'calls the pattern by name oPattern = oDoc.ComponentDefinition.OccurrencePatterns.Item("2 CAB PAT") oPattern.OccurrencePatternElements.Item(2).Suppressed=True
i do understand i need to access the parent pattern (4 CAB PAT) to get to it but i can't figure out how...
thanks for your help
Solved! Go to Solution.
Solved by adam.nagy. Go to Solution.
I messed around with this a for little bit.
First I did a for each loop and returned a message box telling me what patterns were in the component definition.
It only returned the top most parent patterns. so it doesnt recognize the sub patterns at the component definition level.
So I nested another for loop returning a message box for each element in the pattern elements collection.
It returns a message box for element 1 then element 2 etc.
This is where I got stuck, I cant see how to get deeper in to the elements either.
It may or may not be possible with the current API but I wanted to let you know I spent a little time with it.
As a work around is it possible to restructure your pattern to not contain sub-patterns so you can just use the standard item method in your example to suppress what you need?
I need to "Pattern" a cross bar from one to four instance each at different (read independent) spacing, they are always the same part.
it is basically a fully parametered underframe for power cabinet, but the number of cabinet change from 1 to 6, and the size of each of them may be different in width. Using the pattern suppress allow me to bypass adding/removing component, and still count the right amount in the BOM.
Hi,
" i do understand i need to access the parent pattern (4 CAB PAT) to get to it but i can't figure out how..."
Not sure what the problem is but based on the picture it should be this:
Dim oDoc As AssemblyDocument oDoc = ThisApplication.ActiveDocument 'reference the pattern in the assembly Dim oPattern As OccurrencePattern 'calls the pattern by name oPattern = oDoc.ComponentDefinition.OccurrencePatterns.Item("4 CAB PAT") oPattern.OccurrencePatternElements(2).Components(1).OccurrencePatternElements(2).Suppressed=True
PS: best thing is always testing things in VBA.
Cheers,
Thanks for the answer Adam. This had me stumped so I had to give up.
What does .components(1) point to?
This is where I got stuck trying to find him an answer.
I figured I was going to need to use components() but I wasnt sure how.
Edit: Nevermind, I see how its working now. Thanks again.
Since in the meantime I already created a picture for it 🙂 ....
And might be useful for others too: you can pattern multiple components at the same time, that's why there is the Components property:
Cheers,
Can't find what you're looking for? Ask the community or share your knowledge.