Bone matrix (how to get frames)

I decided to give python a try again after realizing that I would still like to animate in blender rather than my tools.

Right now I can get an armature and its bones, but when I print the bone matrix, it seems to be either for the start frame, or the current frame. I’m just wondering how to go about this.

Actually I found out how to get the matrix per frame, but how to I change the active frame in the timeline?

Added a utility function to do this for 2.45
bpymodules/BPyArmature.c - getBakedPoseData(ob_arm, startframe, endframe)
export_cal3d.py uses this. you can get constraints and all pose info baked into a list of values that are compatible with IPO values, so its as if the animation was baked into ipos - you can also access all the frames at once.