Working with dimensions using SOLIDWORKS API
Dimensions can be added to the selected sketch segments via IModelDocExtension::AddDimension SOLIDWORKS API method.
Each dimension has a unique name which can be assigned by the user. Dimension object can be retrieved by name via IModelDoc2::Parameter method.
Refer the IDimension SOLIDWORKS API interface for the list of available methods for dimensions automation.