What MACRO API functions to get and set a part material?

I want to create a macro which to check whether the material has been set. If it is not set, then I want my UI to show and allow to set the material.

Thanks

SolidworksApi macros