How to define a macro in Catia that will add new properties to the part and link them

Can you please tell me how to make a macro that will open the active part properties, define new properties, add mass as a property and link it to the value of the inertia measure mass?

Thank you in advance!
Alex