How to sort structural framing by their orientation (Horizontal and Vertical)?

I want tag Structural Framing elements by horizoltal and vertical.
Thank a lot

@manhgt214 , hi

You can group by Key or Function. here is an example

This’s my script, It’s work!!
Thank you!