function Curves() 'declare variables dim C1,C2,C3,C4 'curves dim C1pt,C2pt,C3pt,C4pt 'series of positions along C1 and C2 dim C1pt1,C1pt2,C1pt3,C1pt4 'actual points on C1 and C2 dim C2pt1,C2pt2,C2pt3,C2pt4 dim C3pt1,C3pt2,C3pt3,C3pt4 dim C4pt1,C4pt2,C4pt3,C4pt4 dim C1ptset dim C2ptset dim C3ptset dim C4ptset C1pt1=array(0,0,0) C1pt2=array(-3,20,2) C1pt3=array(0,40,1) C1pt4=array(2,60,0) C1ptset=array(C1pt1,C1pt2,C1pt3,C1pt4) 'complete set of points on C1 C2pt1=array(5,0,27) C2pt2=array(1,20,25) C2pt3=array(2,40,20) C2pt4=array(4,60,15) C2ptset=array(C2pt1,C2pt2,C2pt3,C2pt4) 'complete set of points on C2 C3pt1=array(0.5,0,0) C3pt2=array(0,20,2) C3pt3=array(5,40,1) C3pt4=array(2.5,60,0) C3ptset=array(C3pt1,C3pt2,C3pt3,C3pt4) C4pt1=array(5.5,0,27) C4pt2=array(4,20,25) C4pt3=array(3,40,20) C4pt4=array(4.5,60,15) C4ptset=array(C4pt1,C4pt2,C4pt3,C4pt4) C1=rhino.addinterpcurve(C1ptset) 'creating C1 C2=rhino.addinterpcurve(C2ptset) 'creating C2 C3=rhino.addinterpcurve(C3ptset) C4=rhino.addinterpcurve(C4ptset) call ribs(C1,C2,C3,C4) 'executing ribs end function 'curves 'create ribs between C1 and C2 function ribs(a,b,c,d) 'set ribs variable to a,b, for later substition of C1,C2 dim ribcurves 'declare ribcurves dim riblines 'declare stright ribs dim i 'declare range dim param1,param2,param3,param4 'parameteres for curve domain dim Uval1,Uval2,Uval3,Uval4 'Umin and Umax dim pset1,pset2,psets1,psets2 'series of positions on C1 and C2 and C3 (mid points) redim pset3(2) redim pset4(2) dim path 'extrusion path dim subdiv 'number of subdivisions subdiv=10 redim ribsCrvset(subdiv) redim riblineset(subdiv) for i=0 to subdiv 'i ranges from 0 to subdiv param1=rhino.curveDomain(a) 'param1 chooses curve domain, in this case C1 param2=rhino.curveDomain(b) 'param2 chooses curve domain, in this case C2 Uval1=((param1(1)-param1(0))/subdiv)*i 'determine subdivisions on UV scale on C1 Uval2=((param2(1)-param2(0))/subdiv)*i 'determine subdivisions on UV scale on C2 pset1=rhino.evaluateCurve(a,Uval1) 'mapping subdivisions (Uval1) on C1 pset2=rhino.evaluateCurve(b,Uval2) 'mapping subdivisions (Uval2) on C2 pset3(0)=(pset1(0)-(2*(subdiv-i))) 'x-coordinates of all mid points (C3) are adjusted pset3(1)=(pset1(1)) 'y-coordinates of all mid points (C3) are adjusted pset3(2)=(pset1(2)+pset2(2))/2 'z-coordinates of all mid points (C3) are adjusted pset4(0)=pset3(0)+0.5 pset4(1)=pset3(1) pset4(2)=pset3(2) ribcurves=rhino.addcurve(array(pset1,pset3,pset2)) 'produce rib curves ribsCrvset(i)=ribcurves path=rhino.addline(pset3,pset4) call rhino.extrudecurve(ribcurves,path) param3=rhino.curveDomain(c) param4=rhino.curveDomain(d) Uval3=((param3(1)-param3(0))/subdiv)*i 'determine subdivisions on UV scale on straight rib 1 Uval4=((param4(1)-param4(0))/subdiv)*i 'determine subdivisions on UV scale on straight rib 2 psets1=rhino.evaluatecurve(c,Uval3) psets2=rhino.evaluatecurve(d,Uval4) riblines=rhino.addline(psets1,psets2) riblineset(i)=riblines call rhino.extrudecurve(riblines,path) next 'next set of rib curves 'create positions on surface dim S1 'declare S1 as lofted surface S1=rhino.addloftsrf(ribscrvset) dim S2 S2=rhino.addloftsrf(riblineset) dim j 'declare j range dim paramu,paramv 'declare parameters on u and v directions for surface domain dim arrparam(1) 'declare Uvals and Vvals for subdivion dim arrpoint 'get a set of points on the surface in both U and V directions dim psetuv rhino.print "this is the limit: "+cstr(limit) dim limit limit=10 'limit number redim clpoints(limit,limit) for j=0 to limit for k=0 to limit 'range of j paramu=rhino.surfacedomain(S1(0),0) 'set up paramu within S1 paramv=rhino.surfacedomain(S1(0),1) 'set up paramv arrparam(0)=paramu(0)+(((paramu(1)-paramu(0))/limit)*j) 'map out a series of U values along u direction of S1 arrparam(1)=paramv(0)+(((paramv(1)-paramv(0))/limit)*k) 'map out a serie sof V values along v direction of S1 arrpoint=rhino.evaluatesurface(S1(0),arrparam) psetuv=rhino.addpoints(arrpoint) 'check to see if positions are successfully obtained clpoints(j,k)=arrpoint 'important:psetuv returns a string, which is not usable when an array is required. next next dim arrsrf 'declare group of surfaces redim S3(limit-1,limit-1) 'single surface S3 for j=0 to limit-1 'declare range for j, with limit-1 in order not to go out of range for k=0 to limit-1 'declare range for k, with limit-1 in order not to go out of range arrsrf=Rhino.AddSrfPt (array(clpoints(j,k),clpoints(j,k+1),clpoints(j+1,k+1),clpoints(1+j,k))) 'create group of surfaces by specifying points on S1. clpoints is a group S3(j,k)=arrsrf 'store S3 in arrsrf next next dim IsoCrv 'declare isocurve dim arrparameter dim isoparam(1) 'declare isoparam: a set of uv values that are different from arrparam redim isoCrvset(limit) dim path2 path2=rhino.addline(pset4,pset3) for k=0 to limit isoparam(0)=paramu(0)+(paramu(1)-paramu(0)) 'u value of isoparam isoparam(1)=paramv(0)+(((paramv(1)-paramv(0))/limit)*k) 'v value of isoparam isopoint=rhino.evaluatesurface(S1(0),isoparam) rhino.print rhino.pt2str(isopoint) arrparameter=rhino.surfaceclosestpoint(S1(0),isopoint) rhino.command "_selcrv _hide" IsoCrv=Rhino.ExtractIsocurve(S1(0),arrparameter,0) 'extract isocurve isoCrvset(k)=isocrv call rhino.extrudecurve(isocrv(0),path2) rhino.print "this is the limit "+cstr(limit) next call rhino.deleteobject(path) call rhino.deleteobject(path2) call rhino.deleteobject(s1(0)) end function curves