How to collect result occcurrences from mirror features

How to collect result occcurrences from mirror features

en9y37
Advocate Advocate
145 Views
0 Replies
Message 1 of 1

How to collect result occcurrences from mirror features

en9y37
Advocate
Advocate

Hi all.

 

I'm trying to collect the result occurrences created from a mirror feature in which the inputEntities are occurrences.

 

I'm trying via the mirrorFeature.patternElements and mirrorFeature.resultFeatures, and in both cases i'm returned none. I've tried rolling the timeline before the mirror feature just in case, but the result is the same:

 

en9y37_0-1739599454485.png

Is this a bug or should I make another approach to get the result occurrences?

 

Here I leave the code to reproduce the issue and the design:

 

import adsk.core, adsk.fusion, adsk.cam, traceback

def run(context):
    ui = None
    try:
        app = adsk.core.Application.get()
        ui = app.userInterface
        design = adsk.fusion.Design.cast(app.activeProduct)
        rootComp = design.rootComponent

        
        for mirrorFeature in rootComp.features.mirrorFeatures:
            #I make sure to collect only mirrorFeatures in which the inputEntities are occurrences
            for occ in mirrorFeature.inputEntities:
                if not occ.objectType == adsk.fusion.Occurrence.classType():
                    break           
            
            else:
                if mirrorFeature.patternElements:
                    #I understand that in case this works, the inputEntites should be item(0) and the result item(1)
                    resultOccurences = mirrorFeature.patternElements.item(1).occurrences

                if mirrorFeature.resultFeatures:
                    resultOccurences = mirrorFeature.resultFeatures

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))      
0 Likes
146 Views
0 Replies
Replies (0)