Trying to create multiple views and clipping planes that clip them, but only seems to create clipping planes on last item

I am trying to create multiple plan views in my model with each view clipped by two planes,one for hiding objects below level and one for cut level. currently, it creates the right views, but i fail to create the clipping planes when i reference the view in AddClippingPlane parameter.

import rhinoscriptsyntax as rs 
import ast

cutHeight = 1200

objdict = ast.literal_eval(rs.GetDocumentUserText("levels"))

def planClips(lvl):
    viewname = lvl["level"] + "_view"
    view = rs.AddNamedView( viewname, "Top" )
    print view
    elevation = float(lvl["elevation"])
    lvlPlane = rs.CreatePlane((0,0,elevation))
    cutPlane = rs.PlaneFromNormal((0,0,elevation+cutHeight), (0,0,-1))
    planes = [lvlPlane, cutPlane]
    clips = [rs.AddClippingPlane(x, 1000, 1000, view) for x in planes]
    group = rs.AddGroup()
    rs.AddObjectsToGroup(clips, group)

map(planClips, objdict)

with view parameter not included what i get is this:

view parameter included:

not sure if im doing something wrong in the script or maybe not understanding clipping planes, but any help would be appreciated.

also, for the data level info the script is iterating a list of dicts that have been saved in the document user text as string,

createPlanViews.3dm (2.7 MB)

Hi @tkahng,

Rather than using named view, might consider creating just 2 clipping planes. Then usin Rhino’s snapshot feature, just save the location of the clipping planes as you move them between levels.

The issue with your code is that you basically have added so many clipping planes, nothing is displayed.

Hope this helps.

– Dale