Hi @melsabbahy. Individual SurfaceBody Type objects do not have their own MassProperties that we can access by code. They do have a Property named Volume though, which you might be able to use to multiply by the part's current Material mass per unit of volume value, to get the mass of that body. I can select a specific SurfaceBody object by code and launch that user interface dialog using the "PartBodyPropertiesCtxCmd" command by code, but I can not click that [Update] button within that dialog by code, and I can not retrieve a per body mass value, because it does not exist in Inventor's API yet. When you launch that dialog with this command, your code is paused until that dialog is closed, similarly to launching an iLogic Form as Modal by code. The active MaterialAsset itself usually does not contain this 'mass per unit of volume' either, but its physical properties asset does contain an AssetValue relating to its Density. But even that density value may not be accurate if it is a custom material that you have not specifically supplied this value for.
Edit: Actually, I am wrong. In Inventor 2023 they introduced the MassProperties Property to the SurfaceBody object, which returns a SurfaceBodyMassProperties object in Inventor's API, but unfortunately I'm still using 2022.4.1 at work, so I did not see that in my tests. So if you have 2023 version, you could use that to get the mass of the body, but I still do not see a method included for ensuring that those mass properties are updated.
Wesley Crihfield

(Not an Autodesk Employee)