The right part is not always available or has become obsolete. That is where maintenance machining come into play. Broken or worn parts can be reversed engineered so a replacement part can be made per the sample. Depending on how the part is worn, it may be possible that the part could be bored, bushed or welded to salvage it. Each situation is different on how to repair if it is repairable.
sometimes it is cost effective to repair than to buy new. This part was worn on the end and could saved.
Welding the shaft on the end is simple but when you weld up in the middle it tends to bend the shaft from heat of the welding.
More time is needed to get the shaft straight in order to machine and have it balanced.
Once the shaft is welded and cooled the machining process takes place returning the welded area of the shaft to the original dimension.
Even commercially bought items needs to modified in order to fit. Keyways need to be added to shafts or sprockets, threads need to added to shafts, sometime special nuts need to be made. drilling hole and shaping material is all part of repairing in order to get machine up and running