Flip objects along X axis straight from Top view?

I do work with a lot of objects that I do need to flip them (rotate 180degrees) on the other side along the X axis, so the bottom becomes the top, looked from top view.

Right now to accomplish this task, I do need to switch between Top view, to Perspective view, zoom to the object, search the gumball Green rotation handle, type 180 and after that it is flips upside-down.

I am searching to speed up this repetitive process and for this, I do need some help if possible.

Maybe somebody can help-me with a script or method with witch I can do all this steps straight from the Top view.


180_Flip_along_X_axis.3dm (112.9 KB)

Maybe this works?

"""Provide angle in degrees and axis vector as input arguments at bottom
Each object rotates about its own center."""

import rhinoscriptsyntax as rs
import Rhino

def RotateObjsAroundBBCtrAxis(deg,axis):
    msg="Select objects to rotate {} deg.".format(deg)
    geo=rs.GetObjects(msg,preselect=True)
    if geo:
        rs.EnableRedraw(False)
        for obj in geo:
            bb=rs.BoundingBox(obj)
            if bb:
                xform=rs.XformRotation2(deg,axis,(bb[0]+bb[6])/2)
                rs.TransformObject(obj,xform)
                
RotateObjsAroundBBCtrAxis(180,Rhino.Geometry.Vector3d.XAxis)

(I’m sending this from my phone, so I haven’t tested…)

1 Like

Thank you for the reply.

One silly question. This script needs to have the .rvb extension?

I do get an error when running the script.

Line: 1
Char: 25
Error: Expected end of statement.

No, this is a Python script. You can save it as a .py extension and run it with _RunPythonScript.

Thank you. It is working now.

OK, cool. You might need to change the last line XAxis to YAxis if you want it to flip in the other direction.

1 Like

thanks Helvetosaur!

a year later…:
I also used your script…
to rotate numbers that needed to be engraved on a double sided table top.
I was especially looking for the individual rotation…
…grasshopper still too time consuming to figure out for me…