Announcements

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

Pick Function and Assembly Patterns

Noah.ClarkX5FEF
Contributor

Pick Function and Assembly Patterns

Noah.ClarkX5FEF
Contributor
Contributor

Hi there,

I'm running into a small problem with my ilogic rule where I have a variable to set to a component occurrence object using the kAssemblyOccurrenceFilter.  On individual occurrences it works fine but it seams to somehow switch to kAssemblyLeafOccurrenceFilter when trying to select a occurrence in an assembly pattern.   Unless I select the occurrence in the model tree it seems to only let me select the individual parts in the sub-assembly.

My questions being

1.  Why does it do that?

2.  How do I have it so it selects the assembly occurrence instead?

0 Likes
Reply
Accepted solutions (1)
568 Views
2 Replies
Replies (2)

Ralf_Krieg
Advisor
Advisor

Hello

 

Why? Don't know. I would also expect to get the assembly, not the containing part.

You can try to check if the picked object is a ComponentOccurrenceProxy. If so, get the ContainingOccurrence object and check again if this is a ComponentOccurrenceProxy. Do this stepping up until the ContainingOccurence is a ComponentOccurrence. If the ComponentOccurrence.IsPatternElement=True then you should have found the assembly in the pattern.

 


R. Krieg
RKW Solutions GmbH
www.rkw-solutions.com
0 Likes

_dscholtes_
Advocate
Advocate
Accepted solution

Hi @Noah.ClarkX5FEF 
I experienced the same thing when I was writing one of my VBA macros. Couldn't find anything about this specific behavior with patterned items.
I ended up creating a class that handles the selection process which actually uses the kAssemblyLeafOccurrenceFilter as filter setting and 'travels up' to find the highest sub-assembly level containing the selected component occurrence. 

    'Check if the selected occurrence is in a sub assembly
    If oOcc.OccurrencePath.Count > 1 Then
        
        'Get the highest sub assembly containing it
        Do Until oOcc.OccurrencePath.Count = 1
            Set oOcc = oOcc.ContainingOccurrence
        Loop
    End If

 

0 Likes