Moving Object to Cplane without affecting Design

I am using a rhino plugin called gem vision matrix, and it has a custom marco called gvGemView, which moves the gem object to 0,0,0 and orientated directly upward.

video of the command working in Matrix plugin here
http://quick.as/oqWLclPRQ

You can see the rest of the objects in the file also move so that the design stays in the same setup.

I am wanting to know how I can do this in rhino with my own scripting

Your help is much appreciated, thanks in advance

Hi @ryanedkins,

is the purpose of the script just to orient the CPlane to the block (the diamond in your case), so you can measure it by creating a CPlane aligned bounding box ? If yes, you might take a look at below old script. It justs aligns the CPlane of the current viewport to a selected block’s transform.

CPlaneToBlock.rvb (708 Bytes)

To run this script from a button, you might use this button command:

_-LoadScript C:\YourPathToTheScript\CPlaneToBlock.rvb

Note that you’ll need to change the path so it points to the location where the script was saved to. If you need this as python script instead, let me know. Btw. to set the CPlane back, use _CPlane _Previous which has its own icon in plain Rhino under the CPlanes toolbar…

c.

Thanks Clement, this is ideal, I’ll be able to work with this script now

thanks again for your help

Ok. just for reference and since the script above is a bit old, here is a python version doing the same:

import rhinoscriptsyntax as rs

def CPlaneToBlock():

    msg = "Select block to orient CPlane to"
    block_id = rs.GetObject(msg, rs.filter.instance, True, False)
    if not block_id: return
    
    xform = rs.BlockInstanceXform(block_id)
    plane = rs.WorldXYPlane()
    plane = rs.PlaneTransform(plane, xform)
    view = rs.CurrentView(view=None, return_name=False)
    rs.ViewCPlane(view, plane)

if __name__=="__main__":
    CPlaneToBlock()

c.