The position of dimension text is controlled by the X,Y,Z parameters of ModelDoc2::AddDimension2. So you need to get the end points of the entity you are dimension to calculate the position of the dimension.
Artem Taturevych, Application Engineer at Intercad (Australia)
translationXpert – add-in to translate SolidWorks models
myIntercad – an integrated tool for SolidWorks Professionals