Revit dim using Python

Using the GeniusLoci package I found some code for making dimensions using Python.

However I can’t seem to apply them to anything but ceiling grids.

How can I dim the entire ceiling/ room width?

#vertices[0] and vertices[1] are the top corners of rectangle
ceilingWidthLine = Line.CreateBound(vertices[0], vertices[1]) 

Dimensions = doc.Create.NewDimension(doc.ActiveView, ceilingWidthLine, refAr2)

The doc is fine, the line is fine… so the issue MUST be with the array.

So this is the bit from GeniusLoci package I’m not really understanding:

    StableRef = e.ConvertToStableRepresentation(doc)
    
    for hatchindex in range(0, 2):
        refAr = ReferenceArray()
        ip = 0
        while ip < 2:
            # generate an index for each hatch reference
            index = (hatchindex + 1) + (ip * 2* 2)
            # create a string for each hatch reference using the face reference and hatch index
            StableHatchString = StableRef + str.Format("/{0}", index)
            # generate a new reference for each hatch reference using the string
            HatchRef = Reference.ParseFromStableRepresentation(doc, StableHatchString)
            refAr.Append(HatchRef) #This reference array is for the hatch pattern
            ip += 1

How is this referencing the ceiling grid when the StableRef is converting the doc, not the ceiling or its grid?

And how do I get it to reference the width of the ceiling instead of a ceiling tile?