A brief update on what I've been working on.
I got basic blueprint transformation capabilities into the last DFHack release. It works great for simple blueprints. It handles the majority of library blueprints just fine. It does have a few limitations, though, that prevent it from being a complete general solution.
First, it transforms the location of a cell with expansion syntax (e.g. d(15x20)), but it doesn't transform the shape of the expanded area. For example, a 5 by 1 area rotated clockwise would properly come out as a 1 by 5 area if each cell were individually designated (e.g. d,d,d,d,d), but if you use the equivalent expansion syntax (d(5x1)), the designation would start at the correct cell, but you'd still get a 5x1 area instead of a 1x5.
Second, buildings get rotated around to the correct tiles, but if the building has a direction associated with it, like which direction a bridge opens or whether an axle is horizontal or vertical, that direction is not modified. This makes rotated versions of these building types not work as expected.
Third, quickfort supports just specifying the center tile of a building on a blueprint and it will automatically expand the footprint of the building to the building type's regular dimensions. For example, you just have to write a single wm to designate an entire 3x3 mason's workshop. Rotation doesn't change anything.. unless the building type has both a fixed size and is not a square. In the current version, these buildings get expanded in different directions depending on the rotation.
Finally, cursor movements on query blueprints don't get modified at all by transformations. If you have one stockpile configured to give to an adjacent workshop, and then you rotate the blueprint, the cursor movements will go off in the wrong direction and the blueprint will error out.
Now, none of this worked correctly in the original python-based quickfort either, but I think we can do better.
Expansion syntax handling is already implemented and merged. As a side benefit, you can now use negative numbers in expansion syntax. This means that you can designate rectangles from any corner now. This includes designations for carved tracks, so it won't be quite as complicated as before to carve track corners.
I've started on implementing rotating direction-specific buildings and footprint expansion. It turned out to be a lot more difficult than I originally expected. Each key sequence that indicates a building type on a blueprint needed an associated database for which other building key sequences it could turn into for each kind of transformation. I'm writing regression tests for my implementation right now.
I have ideas for how to automatically adjust map cursor movements on query blueprints, but I'll write more about that later once I figure out what is feasible.