'MAKING A BRIDGE FROM TWO CURVES '================================================================= 'You are responsible for creating a bridge using the curves below 'The points that create the curves can be manipulated for variance 'in bridge curvature '================================================================= '=======MAKECURVES FUNCTION======================================= 'This function creates two curves from points as paramaters 'the location of points can be manipulated for creating different 'bridge results '================================================================= function makeCurves() 'curves will be created from 4 points 'you are welcome to add more points for creating different 'types of curves, but the minimum should be 4 Dim crvOnePt1, crvOnePt2, crvOnePt3, crvOnePt4 'Define the variables for each point of curve one Dim crvTwoPt1, crvTwoPt2, crvTwoPt3, crvTwoPt4 'Define the variables for each point of curve two Dim crvOne, crvTwo 'Define variables for curves 'Create array of points crvOnePt1 = Array(0.0, 0.0, 10.0) 'create three floats that are the (X,Y,Z) values of the point crvOnePt2 = Array(8.0, 0.0, 20.0) crvOnePt3 = Array(16.0, 0.0, 5.0) crvOnePt4 = Array(24.0, 0.0, 10.0) crvTwoPt1 = Array(-4, 50, 10.0) 'create three floats that are the (X,Y,Z) values of the point crvTwoPt2 = Array(6.0, 50, 4.0) crvTwoPt3 = Array(16.0, 50, 12.0) crvTwoPt4 = Array(26.0, 50, 8.0) crvOne = Rhino.AddInterpCurve(Array(crvOnePt1, crvOnePt2, crvOnePt3, crvOnePt4)) 'Create first curve with array of points crvTwo = Rhino.AddInterpCurve(Array(crvTwoPt1, crvTwoPt2, crvTwoPt3, crvTwoPt4)) 'Create second curve with array of points 'Use the built curves to build bridge call makeBridge(crvOne, crvTwo) end function '**************************************** '===== FUNCTION FOR YOU TO CODE ========= '**************************************** '=======MAKEBRIDGE FUNCTION======================================= 'This function uses the two curves from above function to build 'your bridge '================================================================= function makebridge (crv1, crv2) dim i dim Uval1, uval2 dim paramsOne, paramsTwo, paramsThree dim point1, point2 dim line redim matrix(10,10) crv1=Rhino.getObject("GetObject1", 4) 'select the first curve crv2=Rhino.getObject("GetObject2", 4) 'select the second curve paramsOne=Rhino.curveDomain(crv1) paramsTwo=Rhino.curveDomain(crv2) 'params (0) = Umin 'params (1) = Umax 'divide the curves into 10 segments and assign points to an array for i=0 to 10 Uval1=((paramsOne(1)-paramsOne(0))/10)*(i) point1=Rhino.Evaluatecurve(crv1,Uval1) Uval2=((paramsTwo(1)-paramsTwo(0))/10)*(i) point2=Rhino.Evaluatecurve(crv2,Uval2) line=Rhino.AddLine (point1,point2) paramsThree=Rhino.curveDomain(line) Rhino.Sleep (100) for j=0 to 10 Uval1=((paramsThree(1)-paramsThree(0))/10)*(j) point1=Rhino.Evaluatecurve(line,Uval1) matrix (i,j)=point1 call Rhino.Addpoint(point1) next 'call Rhino.AddLine(matrix 1,1),(matrix 2,1) next 'draws a curve from each point on the first line to the coresponding point 'along each of the other 9 lines for i=0 to 10 redim crvpointsarr (10) 'creates a temporary array to fill with points from the "master" array for j=0 to 10 crvpointsarr (j)=matrix (j,i) 'reverses the vales from the master to create perpendicular lines 'Rhino.Print Rhino.pt2Str (crvpointsarr (j)) ''tests for values in the array next Rhino.AddInterpCurve crvpointsarr ' draws splines along the points in the array Rhino.Sleep (750) next end function makeCurves