iLogic Suppressing the element 2 of a pattern, in a parent pattern problem

iLogic Suppressing the element 2 of a pattern, in a parent pattern problem

yvandelafontaine
Advocate Advocate
2,017 Views
7 Replies
Message 1 of 8

iLogic Suppressing the element 2 of a pattern, in a parent pattern problem

yvandelafontaine
Advocate
Advocate

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:

 

ELEMENT SUPPRESS.JPG

 

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

0 Likes
Accepted solutions (1)
2,018 Views
7 Replies
Replies (7)
Message 2 of 8

Anonymous
Not applicable

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?

 

 

0 Likes
Message 3 of 8

yvandelafontaine
Advocate
Advocate

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.

0 Likes
Message 4 of 8

adam.nagy
Autodesk Support
Autodesk Support
Accepted solution

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,



Adam Nagy
Autodesk Platform Services
Message 5 of 8

Anonymous
Not applicable

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.

0 Likes
Message 6 of 8

adam.nagy
Autodesk Support
Autodesk Support

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:

 

Components.png

 

Cheers,

 



Adam Nagy
Autodesk Platform Services
0 Likes
Message 7 of 8

Wind_Talker
Contributor
Contributor
Hi Adam,

How to do the same thing for all occurrences rather than one specific occurrence.
0 Likes
Message 8 of 8

Wind_Talker
Contributor
Contributor
Hi Guys,

Some help is available to access a pattern component inside a pattern at the following post. Have a look!

http://forums.autodesk.com/t5/inventor-customization/pattern-of-a-pattern-using-ilogic/m-p/6347988/h...
0 Likes