Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
yvandelafontaine
1758 Views, 7 Replies

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

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

7 REPLIES 7
Message 2 of 8
Anonymous
in reply to: yvandelafontaine

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?

 

 

Message 3 of 8
yvandelafontaine
in reply to: Anonymous

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.

Message 4 of 8

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
in reply to: adam.nagy

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.

Message 6 of 8
adam.nagy
in reply to: Anonymous

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
Message 7 of 8
Wind_Talker
in reply to: adam.nagy

Hi Adam,

How to do the same thing for all occurrences rather than one specific occurrence.
Message 8 of 8
Wind_Talker
in reply to: Wind_Talker

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...

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report