can't set body "physical" material after a split operation

can't set body "physical" material after a split operation

alexandre.hersent
Participant Participant
502 Views
2 Replies
Message 1 of 3

can't set body "physical" material after a split operation

alexandre.hersent
Participant
Participant

Hi !

I see that after a split operation the body material is lost, it take the material of the component. So I want to force the body material but it doesn't work (the body appear with the component material not with my material).

                parent_material = comp.material
                try:
                    #Create SplitBodyFeatureInput
                    splitBodyFeats = rootComp.features.splitBodyFeatures
                    splitBodyInput = splitBodyFeats.createInput(body, waterPlan, True) #1: body to be split, 2: SplittingTool, 3:SplittingToolExtended
                    splitBodyInput.baseFeature = baseFeat
                    # Create split body feature                    
                    splitBodyFeats.add(splitBodyInput)

                    # on supprime le plus haut des 2 composants sortant
                    i = CutBody
                    Z0 = baseFeat.bodies.item(i).physicalProperties.centerOfMass.z
                    Z1 = baseFeat.bodies.item(i+1).physicalProperties.centerOfMass.z

                    # I keep only one body
                    if Z0 < Z1:
                        # material assign doesn't work...
                        # The property is at the right material (when printed) but in fusion the material is overwrited by the component material
                        baseFeat.bodies.item(i).material = parent_material
                        baseFeat.bodies.item(i+1).deleteMe()

 Did someone know why ?

Thank you

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

BrianEkins
Mentor
Mentor
Accepted solution

I think what you're seeing is a side-effect of how base features work in Fusion. Here's the description of the bodies property of the BaseFeature object.

 

For a BaseFeature, this property has two different behaviors depending on if the BaseFeature is active for edit or not. When the base feature is active, this property returns the bodies owned by the base feature or the source bodies. When the base feature is not active, this property returns the result bodies.

When a body is added to a base feature, that body is owned by the base feature and is only seen in the UI when the base feature is active. This body is referred to as a "source body". Fusion creates a parametric copy of the body when you exit the base feature. This copy is referred to as the "result body," and it is used for subsequent modeling operations.

You can map between the source and the result bodies by using their position within the bodies collections returned. To get a valid list of result bodies, you should roll the timeline to immediately after the base feature node in the timeline. Otherwise, subsequent operations could have done something to cause one or more bodies to no longer be available.

 

It seems if you assign a material to a body when the base feature is active, the behavior is a bit strange. However, if you get the body when the base feature is not active, so you're getting the parametric "result" body, the material assignment seems to work as expected.

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

alexandre.hersent
Participant
Participant

Thank you, I am not sure I understood everything. For example if I assign the material during the edit of the base feature and I try to get the mass of the body, will it return the mass corresponding to the material I assigned ?

Or did I need to stop the edit, assign the material, get the mass, and restart the edit of the base feature ?

0 Likes