delete dangling reference model dimensions

I was wondering if someone could help me change this macro to work on a part model instead of a drawing. The macro I attached runs through the drawing and deletes any dangling dimensions. I wasn't sure if we could switch a few things to call out the part instead of the drawing and have it work for the model.

SolidworksApi/macros