Message 1 of 1
How to collect result occcurrences from mirror features
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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:
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()))