Ok - you got me inspired to give this a try. See the attached LISP file. Still working on it, but it will do what you want for the most part.
NOTE: This works - kind of. I have to do a better determination of the direction of the polyline to get CW or CCW I think in order to get all the dims "inside" or "outside".
UPDATED: Got everything working, with the help of Gile's (gc:clockwise-p) function and some other edits! try this!
AD-Automatic Dimension Autocad (3).LSP