getDimensions-method function

Generic method to get a dimensions matrix from obj.