Flip Horizontally / Flip Vertically with scripting

Hi there,

I am trying to flip an object horizontally and vertically using the following code

rs.RotateView(direction=0, angle=180.0)  # turn
rs.RotateView(direction=1, angle=180.0)  # turn

could you please explain how to set the direction?
0 =
1 =

Thank you!
Hans Paul

The code above is for rotating the view, not the object. Is that what you want to do, or do you want to rotate the object itself?

I need to export the view as a png (ViewCaptureToFile) so I need to rotate either the view or the object. I’d prefer the former.

OK -
“Flip horizontal” means rotation around the Y axis 180° ?
“Flip vertical” means rotation around the X axis 180° ?

Yes correct

Well, with RotateView() there is no possibility for rotation around the Y axis, only Z (left-right) and X (up-down).

#rotates (flips) around the X axis
rs.RotateView(rs.CurrentView(),2,180)

I think this might work for “flipping” around the Y axis

#rotates around the Z axis
rs.RotateView(rs.CurrentView(),0,180)
#rotates (flips) around the X axis
rs.RotateView(rs.CurrentView(),2,180)

Otherwise, it’s a lot easier to rotate the object…

1 Like

It solved the issue. It’s a good workaround.
Thank you @Helvetosaur!