Reorient Structural Framing

I am trying to reorient all structural framing to have a positive x/y vector.
For all level (non slanted) framing the attached script identified the framing, but does not update the location. The weird thing is, if you slant the framing, the script works correctly.
Anyone know what I am doing wrong?

Can you share a screenshot with all the node preview bubbles pinned? Does everything look correct at first glance?