Few more things from our last motor swap that might save someone a headache.
Encoder cable routing: when you pull the old motor, take photos of exactly how the encoder cable is routed and clamped. On our Komatsu, the encoder cable runs through a specific cable chain path with a service loop at the motor end. The new motor came with a slightly longer cable and the installer just coiled the excess behind the motor. Within a week we were getting intermittent encoder faults — the coiled cable was picking up EMI from the motor power leads running parallel to it. Re-routed it through the original path with proper separation (minimum 200mm from power cables) and the faults stopped.
Weight difference: even "identical" replacement motors can vary by 1-2 kg due to manufacturing tolerances or different production runs. On a vertical-axis servo press, that weight difference changes the counterbalance requirement. After our last swap, the slide was creeping down 0.05mm at rest because the new motor was 1.8 kg heavier than the old one. Had to bump the counterbalance pressure up by about 0.3 bar.
Connector pin-out: verify the encoder connector pin-out before powering up. We had a Fanuc motor where the replacement unit had the same connector but a different pin assignment (it was a newer revision). Powering up with wrong pin-out didn't damage anything — the drive just threw an encoder communication error — but it took 2 hours to figure out because we assumed same connector = same pinout.
Grease the spline coupling before assembly. The old motor's coupling spline will have worn a pattern into the grease. Fresh grease on the new motor prevents the new spline from wearing into the old pattern and extends coupling life. Use the OEM-specified grease, not whatever's in the grease gun — some servo couplings use specific low-friction grease that's different from bearing grease.