splitBodyFeature.count to zero after split

splitBodyFeature.count to zero after split

sebastien.pouvreau
Observer Observer
641 Views
4 Replies
Message 1 of 5

splitBodyFeature.count to zero after split

sebastien.pouvreau
Observer
Observer

Hello.

I am trying to split a shell with a construction plane. The shell is shown on the picture below: it is made of 3 faces making 1 shell which is also 1 lump. But it is as single BRepBody from the API point of view, as it is a single object in my Fusion UI tree (see picture).

Sans titre.pngTo split this shell (selected in "recup_object" which is a BRepBody), I wrote the following code:

    splitBodyFeats = rootComp.features.splitBodyFeatures
    splitBodyInput = splitBodyFeats.createInput(recup_object, planeOne,True)
    splitBodyFeat = splitBodyFeats.add(splitBodyInput)    

When executing, two bodies are created in my Fusion Model, but I am unable to access them in the API because the "splitBodyFeat " object count property is equal to 0, whereas I am expecting it to contain the collection of bodies created, accessible with the bodies property.

In the reference manual, it is written that the body of the createInput method should be "Input solid body or open bodies to be split": is my issue coming from the fact that my recup_object is not a solid body? (isSolid property is False).

In any case, since this seems not to be working, what would be the solution? Is there a specific method/feature to split shells like this?

Thank you for your help.

0 Likes
642 Views
4 Replies
Replies (4)
Message 2 of 5

kandennti
Mentor
Mentor

Hi @sebastien.pouvreau .

 

The SplitBodyFeature object does not have a Count property.

To check the number of bodies after splitting, it is possible to do the following

print(splitBodyFeat.bodies.count)
0 Likes
Message 3 of 5

BrianEkins
Mentor
Mentor

This seems like a bug to me. I would also expect the bodies property of the SplitBodyFeature to return the bodies created due to the split. I think there is a fairly simple workaround. Before creating the split, you can create a list containing all the current bodies. After the split, you can get all the existing bodies. You can check each body in the "after" list to see if it exists in the "before" list. If it doesn't, then it was created by the split feature. You can compare two bodies to see if they're the same by using the "==" operator in an if statement.

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

sebastien.pouvreau
Observer
Observer

Thank you @BrianEkins , it seems like a bug indeed. I used your workaround, much more elegant than what I was doing before :). I hope this will be solved sometime: is there a way to raise a ticket for the API developpers?

0 Likes
Message 5 of 5

BrianEkins
Mentor
Mentor

I've had a ticket created for the bug. Unfortunately, there's no way to track this outside of Autodesk. I don't know when it will be fixed, but they have been actively working on API fixes and enhancements lately, so I'm guessing it won't be too long.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
0 Likes