Aligning a markup plane to world coordinate system, with orthogonal planes

I am relatively new to 3D Slicer, and haven’t programmed in Python for a while, so please bear with me. In my Slicer environment, I have placed a scapular model (“Model”), and a markup plane (“P”) with associated points “P1”, “P2”, and “P3.”

I have two aims:

  1. Align the current markup plane “P” with the existing world coordinate system X and Y axes such that when I navigate to different views in Slicer (e.g. superior or inferior), they are consistent with my markup plane
  2. Create an orthogonal transverse plane that passes through P1 and P2 and is representative of the Z axis

Please see the accompanied annotated image to better describe what I am looking to do.

I have read a number of articles on this forum, and I believe that I’ll need to do some transformations and apply them to both the model and the plane(s), but I am unsure on how to move forward with this from a script perspective. Manual registration is unfortunately not accurate enough for what I am doing.

Thank you in advance for any assistance that anyone is able to provide!

If i have well understood your requirement, this reply to a more or less similar question may be helpful. If you copy and paste the reference codes in your application startup file, you’ll get a nice GUI as a toolbar to perform such reslicing.