How soon after a total knee replacement should someone use an exercise machine?

1st week is okay. As most therapists don't need any machines to perform proper therapy. Manual therapy can achieve excellent results without machines. However, machines can be used as an adjunct to good manual stretching and strengthening programs. Stationary bikes can start early in the first week as the swelling reduces. Weights should be avoided until full extension is gained from your stretching program.
As soon as possible. Start with exercise bike with seat high. Simply rock operative leg back and forth using unaffected leg strength on opposite pedal. Work up to getting operative leg all the way over the top. Once you can get the operative leg all the way over, then start lowering the seat. As your bending improves, then start adding resistance. With an exercise bike alone, you can fully rehab a total knee.
Ask your PT. Work with your physical therapist to get back into an exercise routine. It shouldn't be too long!