Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

splitBodyFeature.count to zero after split

4 REPLIES 4
Reply
Message 1 of 5
sebastien.pouvreau
226 Views, 4 Replies

splitBodyFeature.count to zero after split

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.

4 REPLIES 4
Message 2 of 5

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)
Message 3 of 5

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

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?

Message 5 of 5

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report