Move EVERYTHING relative to origin

Is there any way to move everything in a file (geometry on layers that are on or off, locked objects and layers, cameras, named views) relative to the origin?

I’m working on a building project that is fairly developed and now need to move the building down to a new height relative to the Rhino origin.

Essentially, I want to set a new Rhino origin and leave everything in my scene where it is, but I don’t think that’s possible is it?

A

Would a new CPlane at the wanted origin would work for you? You can use a Universal CPlane so that all the viewports’ CPlanes are relative to each other.

Hi Marc,
I’m using visualArq and the aim is to get the visualarq levels showing correctly relative to the origin, so i really need to move the origin, or everything else within the file.

A script could do this, probably with the exception of named views, which might be hard to change - I’m not sure that just moving the cameras/targets by the same displacement would be correct…

–Mitch

The following Python script is perhaps a bit simplistic, but you can try it… It will move all geometry in the file from one point to another, including anything locked or hidden, lights etc. It also translates all views found in the file, including named views… However, as you mention VisualArc - I do not know what it will do with plug-in data, it has the potential to wreak havoc with your file if something goes wrong, so use with caution.

–Mitch

import rhinoscriptsyntax as rs

"""Script by Mitch Heynick, 18 September 2013.
Moves everything in the file from a base point to a new point.  
Moves all geometry, lights, etc. including locked and hidden objects. 
Also translates all named views by the same vector as the objects
Save your file before doing this, no guarantees!"""

def TranslateAllViews(vec):
    cView=rs.CurrentView()
    nViews=rs.ViewNames()
    if nViews==None: return
    for view in nViews:
        CT=rs.ViewCameraTarget(view)
        rs.ViewCameraTarget(view,CT[0]+vec,CT[1]+vec)
    rs.CurrentView(cView)

def MoveEverythingInFile():
    oPt=rs.GetPoint('Current "origin" - Point to move all geometry FROM')
    if not oPt: return
    nPt=rs.GetPoint('New "origin" - Point to move all geometry TO')
    if not nPt: return
    
    objs=rs.AllObjects(include_lights=True,include_grips=True)
    if objs==None: return
    tVec=nPt-oPt
    rs.EnableRedraw(False)
    rs.MoveObjects(objs,tVec)
    TranslateAllViews(tVec)

MoveEverythingInFile()

Hi Mitch,

Wow, that looks great thanks! Now, to try it on a real file…

A

Mitch,

I cannot thank you enough. That script saved me from redoing weeks of work! While my named views did not translate the active viewports did, so I was able to move the named views by opening all the ones I needed as active viewports and re-saving them after the geometry was moved.

-D

Thanks a lot Mitch,

Im using your script in Rhino 7 and it seems to work very well except for the cameras. They dont move to the new location and they stay in the original place.

Any idea why?

Thanks in advance

p

Hmm, do you have a file with some named views to test? Maybe something changed from V6 to V7 on how this is handled.

2 posts were split to a new topic: Moving named views

Hi!

This might help me a lot. I feel real stupid here, but how do I import the script as rs?
/Edvin