Setting "replace mass" by equation in solidworks

Hi all

I try to parameterize the replacement of the mass of a part by going through the equations and reach this cell to put the desired value there:
2025-07-09_16h22_16

I have the feeling that it is not possible, but I may be wrong.

Thank you all.

Hello;

I don't think this is possible directly by equations (and I don't see the point, Solidworks is supposed to calculate the mass of the component as a function of the density of the material that is dynamically assigned to it)
On the other hand, it is possible to " force " the mass property via a Macro:
https://help.solidworks.com/2020/English/api/sldworksapi/Get_Mass_Properties_using_MassProperty_Object_Example_VB.htm
But also to retrieve the result of an equation:
https://help.solidworks.com/2021/English/api/sldworksapi/Get_Equation_Values_Example_VB.htm
=> All that remains is to:
Or integrate the equation into the macro.
Either retrieve the result from Solidworks and force the mass with the equation...

But, unless you're playing with imported components or multi-body parts (and on the latter it's also questionable since it's possible to affect multiple materials), I think it's better to use the materials correctly rather than forcing the masses.

Kind regards.

1 Like

Hello
There is an interest in the case of a pre-study in which we want to add volumes (without material) to validate a layout in a complex assembly and that we impose a mass on this volume to check the center of gravity of the whole.