Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5825

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

$
0
0

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)

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 5825

Trending Articles