We have a number of aging "Lasko" box fans. One of the injection molded knobs failed. The plastic became brittle and there wasn't much of it. I made this replacement knob in OnShape, which should outlast the fan.
Unfortunately the switch underneath was not a simple D shape, it was much more ornate. I did my best to replicate it and was worried that it required details too small for my printer (Prussa i3mk2) to reproduce. It works fine.
Note the photo shows the pips I added to the side to indicate the setting, but they are reversed. I fixed the model before I posted it.
I recommend ABS for this purpose, as it is less likely to crack and fail. But PLA should work fine.
Be sure to print this "top" down. Support is not required.