Get assemblyContext from InterferenceResult entities
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I've ran into an issue using the results from an interference analysis, I'd like to perform an interference check between multiple occurrences (not components!). This seems to work fine and gives correct results, however, when parsing the created InterferenceResult object I'm unable to determine which occurrences are interfering, only the components.
The InterferenceResult contains two bRepBodies, entityOne and entityTwo. I am able to see which component they belong to using res.entityOne.parentComponent.name, but I'm interested in finding the occurrence of this component which is responsible for the interference. A bRepBody is supposed to have an assemblyContext which returns the occurrence in the assembly, but this is always null for entityOne and entityTwo. Is there a way to connect entityOne and entityTwo to their respective occurrences in the assembly?
Below is a code snippet in which I try to determine which occurrence is interfering. (Note: my code works perfectly when there's only unique components)
...
interferenceInput = design.createInterferenceInput(interferenceCollection)
results = design.analyzeInterference(interferenceInput) #execute interference analysis
#TODO find a way to indentify interference results (components vs occurrences)
for res in results:
res = adsk.fusion.InterferenceResult.cast(res)
if res.entityOne.parentComponent.name == occurrence.name.split(':')[0]:
...
I am fairly new to fusion360 and it's api so this problem might be caused by a misunderstanding of how occurrences, components, and bodies are connected, but I feel like there should be a way to see which occurrences are interfering using the api, since the UI interference analysis does give occurrences as results, instead of their components:
(notice the ':1' and ':2' indicating which occurrence is interfering, as opposed to only returning 'Part-2' using the api.
A solution I'm considering now is to loop through all occurrences in the assembly and if there are multiple occurrences per component, copying these occurrences into new components with unique names, but this doesn't seem very efficient to me.
I hope I've explained the issue well enough
Thanks in advance and kind regards