Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

How to analyze interference between a component and a body from array?

AVIsz
Explorer

How to analyze interference between a component and a body from array?

AVIsz
Explorer
Explorer

Hi All, 

 

There are two components, Component1 (named as wp) and Component2 (wh). The Component2 is actually an array of bodies. This array is positioned relative to the Component1 with some overlap. Supposing that we iterate the bodies within the array from first to last, we need to identify the number of the first body that touched (intersected) with the Component1.

I tried to modify the sample from Fusion 360 API User’s Manual like this:

 

 

 

 

allOccs = rootComp.occurrences       
wp = allOccs.item(0).bRepBodies.item(0) 
wh = allOccs.item(1).bRepBodies 
bodies = adsk.core.ObjectCollection.create()
for i in wh:
            bodies.add(wp)
            bodies.add(i)
            input = design.createInterferenceInput(bodies)
            results = design.analyzeInterference(input)
            if results == True:
                ui.messageBox('yes')
                break
            else:
                ui.messageBox('no')
            bodies.removeByItem(i)

 

 

 

 

 

It always returns ‘no’.

Could you please give me an idea how to solve this task?

 

Alexander.

0 Likes
Reply
284 Views
1 Reply
Reply (1)

tykapl.breuil
Advocate
Advocate

Your problem is that the analyzeInterference object returns an InterferenceResult object, and not a boolean. Since it is not a boolean, it is never equal to True. The condition you'll want to use is probably :

if results.count > 0:

But I encourage you to check the documentation of the interference results object here:

https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-1ACCFF4A-EE7F-4631-BB42-B8C0DA2DC1DE

 

1 Like