No - it is done by feel. As Jay says, shafts should be aligned, with space around 1/8" or even less, as close to the motor as possible. Use K&S tube on the worm shaft or motor shaft as required to ensure a good fit with the tube. Once in a while I will use contact cement or even a wrapper of safety wire to ensure no slipping between shaft and hose. Usually not necessary.
Bear with me - I may overload you with photos. Things to note are "motor mounts", the hidden drive shafts, and in the case of the Mallets, the speedometer cable U joint between engines. I do not have a shot with the brass tube cradle, but you get the idea - I need the motor as low as possible. On oil-fired locomotive models, the Pittman simulates the firebox ash pan.
The above is the mechanism for my ten part OSN series. Motor is an 8324 - resting up there is a 9236. This is the one with 24:1 front, 25:1 rear gearing. Works great!
Lost Wax Mikado. This one is my #786, the Austin Steam Train locomotive. I should check on their progress.
Another idea for a motor mount. Note the brass pipe segment adjusting the motor angle. This one is under an MTH Hudson. Yes, I did the center driver counterweight. Yes, those are MTH rods and valve gear.
Log-Mallet. Only model I ever did with ball bearings on axles. Don't bother. This one needs to be tender drive.
Finally, just for grins, the NP Challenger. Yes, it runs. Yes, it is noisy. Yes, it was a fun idea, and patentable. No, I would not recommend it. Front driveshaft runs right through the rear, just like a turbojet engine shaft connecting fan with turbine, and compressor running on the outside of that shaft. I called it "twin spool." Ball bearings on the rear were expensive - but "comped."