Reset CPlane

Do you have a top view open or is it named something else? setactiveviewport uses the title and not necessarily the type of view. You can append the macro by adding a _4view to the beginning so that it will always run, but keep in mind that it would always reset your viewports to the 4 default.

!_4view _SetActiveViewport Top _CPlane _World Top _pause _SetActiveViewport front _CPlane _World Front _pause _SetActiveViewport Perspective _CPlane _World Top _pause _SetActiveViewport Right _CPlane _World Right _pause _SetMaximizedViewport Perspective

1 Like

@stan is there a way to just reset the CPlane without this distracting in and out of the windows automatisation?

Correct! Thank you
image

I’m after the same thing :wink: ! If anyone finds out

-CC

Hi CC - CPlane World Top is not it?

-Pascal

hi @pascal ,

It works for top and perspective VP, but not for front VP, it didn’t reset it with its original default position.

I thought the command _NamedCPlane _Restore was the way to go but seems I’m mistaking…

-CC

1 Like

I see - so if the view is one of the defaults, find the relevant Cplane… this python will do that for the Front, Top, Right, Perspective views:

import Rhino
import scriptcontext as sc
import rhinoscriptsyntax as rs


def test():
    
    names = ['front','right', 'top',  'perspective']
    planes = [ Rhino.Geometry.Plane.WorldZX,Rhino.Geometry.Plane.WorldYZ, Rhino.Geometry.Plane.WorldXY,Rhino.Geometry.Plane.WorldXY]
    vp = sc.doc.Views.ActiveView.ActiveViewport
    
    if vp.Name.lower() in names:
        rs.ViewCPlane(plane = planes[names.index(vp.Name.lower())])

    
test()

SetDefaultViewCPlane.py (515 Bytes)

To use the Python script use RunPythonScript, or a macro:

_-RunPythonScript "Full path to py file inside double-quotes"

-Pascal

2 Likes

Excellent @pascal,

It works just fine ! Hope it will be implemented inside rhino.

Regards,
-CC

Hi Pascal. Could the red-text list of views in your script be replaced with a dynamic list of both the default named views and all other user-defined named views in the file?

I’m thinking along the lines of having user named CPlanes with the same name as the views (yeah, I know that requires a lot of user discipline but it’s what I do already anyway) then using the view name to ‘master’ the active CPlane in that viewport. If there’s no CPlane name available I guess the command would just bale out(?)

Hi Matt -I’ll see what I can do - not sure. NamedViews offer to restore the CPlane with the view - does that help?

@MattE - I think this one is what you want - maybe.

SetDefaultViewCPlane.py (896 Bytes)

-Pascal

1 Like

Many thanks Pascal. I’ll give the new script a try.

I wasn’t aware of that setting in Options and I see it’s present in both V5 and V7. What does Rhino feed off to inform that “Named views set CPlane” option? Does it remember the active CPlane when a named view is first saved? What then happens if the CPlane is changed with that named view active?

This all goes back to the other thread I posted in about knowing which CPlane is currently active in a viewport. Rhino doesn’t keep the user informed about the active CPlane unless they go digging in cascading menus.

You can use the CopyCPlaneToAll command , and cope the Cplane from another view that hasn’t been edited.

dude I google this post on a weekly basis… the fact that I haven’t set up an alias to the command yet… mildly ashamed of myself :rofl:

still need to get around to it :rofl: