I’m writing a little script to find clipping planes hiding in inactive layers, but having trouble getting a proper viewport object to use as the argument for the clipping plane’s IsActiveInViewport method.
I’ve tried:
- Using the viewname:
for vp in rs.ViewNames():
if cpo.IsActiveInViewport(vp) and not rs.IsLayerOn(cp_layer):
But the viewname is a string and not a RhinoViewport
- Coercing from the viewport name returned by rs.ViewNames:
for vp_id in rs.ViewNames():
vpo=rs.coercerhinoobject(vp_id,True,True)
but the viewnames aren’t guids
- Getting views from scriptcontext:
sc.doc.Views.GetEnumerator() #wrong type, RhinoView instead of Viewport
Full script follows:
import Rhino
import rhinoscriptsyntax as rs
import scriptcontext as sc
cps = rs.ObjectsByType(536870912)
if len(cps)>0:
print("Found clipping planes")
for cp_id in cps:
cp_layer=rs.ObjectLayer(cp_id)
cpo=rs.coercerhinoobject(cp_id,True,True)
for vp in rs.ViewNames():
if cpo.IsActiveInViewport(vp) and not rs.IsLayerOn(cp_layer):
print("An active clipping plane is hiding on ",cp_layer)
else:
print("Found no clipping planes")
1 post - 1 participant