Option Explicit 'Script written by Luis Gil 'Script copyrighted by www.legil.org ''offsets the surface in a poly to create lattice look. Call offsetPolySrfs Sub offsetPolySrfs Dim arrPolys arrPolys = Rhino.GetObjects("Select polysurfaces", 16, , True) If IsNull(arrPolys) Then Exit Sub Rhino.AddLayer "JoinSuccess", RGB(255, 0, 150) Rhino.CurrentLayer("Default") Dim i, j Call Rhino.EnableRedraw(False) For j = LBound(arrPolys) To UBound(arrPolys) Rhino.Print "Processing " & j+1 & " of " & UBound(arrPolys) + 1 & " polysurfaces." Dim arrXSrfs : arrXSrfs = Rhino.ExplodePolysurfaces(arrPolys(j), True) If Not IsNull(arrXSrfs) Then Rhino.CurrentLayer("JoinSuccess") ReDim arrNewXSrfs(UBound(arrXSrfs)) For i = 0 To UBound (arrXSrfs) Dim arrPc, arrCentroid arrPc = Rhino.SurfaceAreaCentroid(arrXSrfs(i)) arrCentroid = arrPc(0) Dim arrBoundCrv, strScCrv arrBoundCrv = Rhino.DuplicateSurfaceBorder(arrXSrfs(i)) Dim arrBound : arrBound = Rhino.JoinCurves(arrBoundCrv, True) strScCrv = Rhino.ScaleObject(arrBound(0), arrCentroid, Array(0.9, 0.9, 0.9), True) arrNewXSrfs(i) = Rhino.AddLoftSrf(Array(arrBound(0), strScCrv)) 'Rhino.DeleteObjects arrXSrfs Next 'Rhino.JoinSurfaces arrNewXSrfs, True End If Rhino.CurrentLayer("Default") Next Call Rhino.EnableRedraw(True) End Sub