There are actually quite a few posts in the forum about dimensioning to elements other than grid lines and walls. Just have to critique your search words to find the right ones. Below are a couple for you.
To help, GeniusLoci has two nodes that you will need: “Element Reference” and “Dimension ByReferences”.