Inconsistency assigning bodies after cut operations

Inconsistency assigning bodies after cut operations

lucas.devito
Explorer Explorer
513 Views
2 Replies
Message 1 of 3

Inconsistency assigning bodies after cut operations

lucas.devito
Explorer
Explorer

I'm running the same script with the same input parameters and getting different results. I find this inconsistency to happen after cutting operations, when assigning the new body in the bodies list. For example, if I run a cut operation between a cube and a plane in the cube's center, the result is two cube parts. The right side is assigned to be rootComp.bRepBodies.item(1), and the left side is assigned to be rootComp.bRepBodies.item(2). However, if I run this script multiple times, this order might reverse and prevent subsequent operations. Has anyone been through this before? Might be an update bug or likely to be my code? Any help is appreciated. Thank you!

0 Likes
Accepted solutions (1)
514 Views
2 Replies
Replies (2)
Message 2 of 3

BrianEkins
Mentor
Mentor
Accepted solution

It's usually not good to rely on the order of things that are returned by the API unless it specifically says they are returned in a certain order. The API returns them in the order it gets them from Fusion and the order may not always be consistent. I know you're seeing the difference in the same version but it would be more common that there might be a small change in the modeling core that would cause a difference from one version to another. In any case, it's better to evaluate the results geometrically and find them based on some unique geometric trait. For example, in your case, you can use the bounding boxes of the bodies or the center of gravity to get their position and then compare them to find the one to a specific side of the cut plane.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 3 of 3

lucas.devito
Explorer
Explorer

Thank you @BrianEkins, that makes sense!

0 Likes