There is a trick that could do this...
I'll use 'metres' in the example below but you can adjust this to suit whatever units you want...
Make a 1m long dimension (X) against a horizontal edge - in a 'flat' XY orientation, with a 1m long leader offset (Y).
Highlight the dim and make it into a component - called let's say 'Dim'.
Save it externally as its own 'skp' - into a logical folder path.
In a model, your script then inserts an instance of Dim.skp from the folder.
In your model/script you have the required edge...
The edge has a knowable length (let's say 2.1m), so your script transform scales the instance proportionately by x2.1 in X.
The figured dimension will automatically adjust to 2.1m to suit.
You can also adjust the leader scale (Y).
Transform the instance location and rotation to suit the edge's.
You now have a dimension that reflects the edge's length and orientation. You can also use this method to script a 'dimension' between any two known points...
You might also be able to change the 'orphaned dim' colour to match the normal dim's colour ? Not sure how to access/set this ???
The dim's arrow heads will scale in the X... too so you might want to make a set of Dim skps - say 1-100mm, 100mm-1m, 1m-3m, 3m-10m etc and then insert instances of them to match nearest to the edge's length - so that the subsequent scaling of them wouldn't distort the dim-compo's arrow heads too much...
You could also 'connect' the edge and component-dim using attributes and observers, so if the particular edge changed, then the associated dim-compo could be adjusted automatically to suit... It would then behave very much like a normal associated dimension.
This could be all very convoluted to achieve, BUT it's still possible...