How do I write a Macro to add a custom property that uses Dimensions?

I'm trying to get this equation to go into a macro that will insert it into the properties of a part.

SolidworksApi macros