Wish: extract clippingplane clipping info into curves (and hatches)

It is quite simple really:

import Rhino
import Rhino.DocObjects as rdob
import scriptcontext as sc

cps = [ob for ob in sc.doc.Objects if ob.ObjectType == rdob.ObjectType.ClipPlane]
selob = [ob for ob in sc.doc.Objects if ob.IsSelected(False)>0]

Rhino.RhinoApp.RunScript("_SelNone", False)

if len(selob)==1 and len(cps)>0:
	srfs = rdob.RhinoObject.GetFillSurfaces(selob[0], cps)
	print(srfs)
	for srf in srfs:
		print(srf)
		id = sc.doc.Objects.AddBrep(srf)
		sob = sc.doc.Objects.FindId(id)
		print(id, sob)
		sob.Select(True, True)
	
	sc.doc.Views.Redraw()

With file demo_getfillsurfaces.3dm (204.4 KB)

Select the torus before running the script. It adds a bunch of breps as the filling faces. Disable to clipping planes and hide the torus to see.

4 Likes