Custom design check - layers

Look at the macros in this post https://forum.cadmunity.com/t/custom-save-macro/1299/1

The macros posted here might not be same as you need but can guide you in a direction.