that should work for the keyed shaft.
for the gear, draw a circle and then one tooth then circle pattern it around and extude. however, if ur doing something complicated like an assembly, i would STRONGLY advise not to use teeth. this will make ur inventor go so slow and maybe even crash...not to mention those constaints

what i did was make a simple circle with the dimensions. much easier on the machine and me