- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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
www.rkw-solutions.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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