Convert teached program for fixed workpiece to program for moving workpiece