I've completely forgotten how to do this - coaching request.

A current project involves playing MIDI freely to Logic, and when I find things I like I want to turn them into individual projects.

I could stretch the desired segment until it fits the default grid, print, then play it in to a click. But then I'd lose the feel of the original.

Any tempo change I try will alter the speed at which the fragment play back, so again, I lose the feel.

I could bounce it to audio and then match the tempo to the audio file.

Any other ideas?

I've been trying to do the same thing. I thought there was some new feature in Logic 9 that allowed you to do this more easily but haven't yet tried to look for it.
I've done it with little success manually. You can do audio with "audio to score" or "audio to midi" with the functions menu in the sample editor but that's all I can find so far.......SC
I just tap and record a click track along to what I played, then use the beat mapping. (View menu> configure global tracks)

There is an option in beat mapping called beats from region. You select the region of your recorded click track and it asks you to specify whether you tapped crotchets, minims etc.

It then creates a tempo map.
This method relies on you being able to accurately tap a click track along. Alternatively you can do it more accurately by using a manual method of lining up the grid with MIDI notes, e.g. the first of each bar or whatever you choose. To do this just click on a beat in the beat mapping grid, you then see a yellow line which you grab and move to the relevant beat in your MIDI region, and this creates the tempo change for that bar. In this example I am making the fifth note of a series of crotchets fall on bar 2:


You need to first move the MIDI notes so they start on beat 1 or it can get weird.