Auto tolerance

Is there a way to automatically set the tolerance based on the value of the dimension? For example, if the dim. is 0 to 10 mm +/- .20 mm if the dim. is 10 to 20 mm +/- .35 mm. I don't think there is a setting that will do this but is it possible through a macro?

SolidworksParts And Features