So dimensioning is a bit awkward because References don’t have any geometry which we can view to see what is going on.
To create a dimension you need at least a pair of References… In your above example you will need a Reference from the Grid Line and a Reference from the family, perhaps the Center (Front/Back) Reference.
You also need a line to create the dimension on, so it must be parallel to ‘D’, depending on your family, this is not necessarily the case with the location line.
Your example will be further complicated because you need to create the correct list structure for Dynamo to understand what you want… So you will need sub lists per element… A sub-list with a line which corresponds to a sub-list of references.
I would have a search around in the forum and do some reading… Auto dimension MEP - #8 by Alban_de_Chasteigner
Then I would make a very basic example with only 1 dimension you are trying to create… Once that is working, I would increase the complexity.
If it isn’t working, I would probably try and create lines to visualise all the pieces you are trying to use when creating the dimension.
Hope that helps