This is a remix of TNS remix of droftarts thing
Take care: This will only take effect if the pulleys diameter is lower than the bases diameter. The pink pulley in the first picture for example will be drawn in the conventional way.
I improved the generation of the belt retainer. The chamfer for the transition from the teeths to the retainer will get a fix angle of 45 degrees (better for printing without support). If the so from the hight resulting diameter of the retainer is lower than the bases diameter the generation will be done like in the original script. If the diameter will be higher the chamfer stops at the bases diameter and the edge will continue vertical from there. See attached picture as example for this case. Additionally I made the precision for the circle generation customizable. The original value was a bit raw.
For detailled informations of usage refer to the remix sources.
I'm not so firm in SCAD. If there can be optimized something of my Code hints will be welcome.
Edit 2019/05/20: Attached V2.1 with a bugfix in selection of retainer-generation type.
Edit 2019/05/21: included a hint from beikeland regarding a pulley diameter greater than base diameter