I am attempting to automate the creation of an array of poses (as a poselib) for a mechanical system in Python, based on known scene geometry. I have a rigged armature that works well having constraints representing a robot that sorts semiconductor wafers.
The geometry of movement (aka the locations at which I want to place the rigs ik control bone) is well known. My present approach is to place the rig at a known location within the scene, and mathematically generate all the locations to which the control bone could be moved, and store a pose at each location, which I will use later for animation.
My problem is how to move the ik control bone to a specific XYZ position (allowing the existing ik constraint in the rig to calculate joint locations), then create and store the pose, while looping through all the calculated positions. I think the problem I am stumbling over is relatively simple, but am struggling on the python syntax (Blender 2.93) to move the rig, create the pose, and store it.
The specific syntax I need (while in POSE mode) is to:
- move the control bone to a specific XYZ location in world space, then
- (create and ?) store the location in a known poselib.
I have a reference to the rig, the poselib, a unique name for the pose, and the ik control bone within the rig. I just need the syntax to move the control bone and store the pose in the poselib. I've made multiple attempts, but the trial and error to get the syntax correct and working is driving me crazy.
I found this (old) article, but the approach seems overly complex, and python syntax has long since changed.
Any quick code snippets would be much appreciated.