Option Explicit

Call WhoFramedTheSurface() Sub WhoFramedTheSurface()

   Dim idSurface : idSurface = Rhino.GetObject("Surface to frame", 8, True, True)
   If IsNull(idSurface) Then Exit Sub
   Dim intCount : intCount = Rhino.GetInteger("Number of iterations per direction", 20, 2)
   If IsNull(intCount) Then Exit Sub
   Dim uDomain : uDomain = Rhino.SurfaceDomain(idSurface, 0)
   Dim vDomain : vDomain = Rhino.SurfaceDomain(idSurface, 1)
   Dim uStep : uStep = (uDomain(1) - uDomain(0)) / intCount
   Dim vStep : vStep = (vDomain(1) - vDomain(0)) / intCount
   Dim u, v
   Dim pt
   Dim srfFrame
   Call Rhino.EnableRedraw(False)
   For u = uDomain(0) To uDomain(1) Step uStep
       For v = vdomain(0) To vDomain(1) Step vStep
           pt = Rhino.EvaluateSurface(idSurface, Array(u, v))
           If Rhino.Distance(pt, Rhino.BrepClosestPoint(idSurface, pt)(0)) < 0.1 Then
               srfFrame = Rhino.SurfaceFrame(idSurface, Array(u, v))

Call Rhino.AddPlaneSurface(srfFrame, 1.0, 1.0) End If

   Call Rhino.EnableRedraw(True)

End Sub

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.