How do you make a macro to dimension specific features

Hi,

I am planning to make a macro to dimension multiple different files that has cutouts with more than one shapes. I just want it to dimension the midpoint of the feature to the edges. The attached picture is an example. imagine a door knob with screw holes. I jsut want to dimension where the middle of the knob will be at from the edges, not the screw holes etc. How can i do that with macros? I am new to it so can you please give me example macros and help files. Thanks.

SolidworksApi macros