'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 and a base with two 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 crvFivePt1,crvFivePt2,crvFivePt3,crvFivePt4 Dim crvThreePt1,crvThreePt2,crvThreePt3,crvThreePt4,crvThreePt5,crvThreePt6,crvThreePt7,crvThreePt8,crvThreePt9,crvThreePt10,crvThreePt11 Dim crvFourPt1,crvFourPt2,crvFourPt3,crvFourPt4,crvFourPt5,crvFourPt6,crvFourPt7,crvFourPt8,crvFourPt9,crvFourPt10,crvFourPt11 Dim crvArcaPt1,crvArcaPt2,crvArcaPt3,crvArcaPt4 Dim crvArcbPt1,crvArcbPt2,crvArcbPt3,crvArcbPt4 Dim crvArccPt1,crvArccPt2,crvArccPt3,crvArccPt4 Dim crvArcdPt1,crvArcdPt2,crvArcdPt3,crvArcdPt4 Dim crvBaseaPt1,crvBaseaPt2,crvBaseaPt3,crvBaseaPt4,crvBaseaPt5,crvBaseaPt6,crvBaseaPt7,crvBaseaPt8,crvBaseaPt9,crvBaseaPt10,crvBaseaPt11 Dim crvBasebPt1,crvBasebPt2,crvBasebPt3,crvBasebPt4,crvBasebPt5,crvBasebPt6,crvBasebPt7,crvBasebPt8,crvBasebPt9,crvBasebPt10,crvBasebPt11 Dim crvOne, crvTwo, crvFive, crvThree, crvFour, crvArca, crvArcb, crvArcc, crvArcd, crvBasea, crvBaseb '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(4.0, 0.0, 7.0) crvOnePt3 = Array(8.0, 0.0, 7.0) crvOnePt4 = Array(12.0, 0.0, 10.0) crvTwoPt1 = Array(0.0, 50, 10.0) 'create three floats that are the (X,Y,Z) values of the point crvTwoPt2 = Array(4.0, 50, 15.0) crvTwoPt3 = Array(8.0, 50, 15.0) crvTwoPt4 = Array(12.0, 50, 10.0) crvFivePt1 = Array(0.0, -50, 10.0) 'create three floats that are the (X,Y,Z) values of the point crvFivePt2 = Array(4.0, -50, 15.0) crvFivePt3 = Array(8.0, -50, 15.0) crvFivePt4 = Array(12.0, -50, 10.0) crvThreePt1 = Array(0.0, -50.0, 10.0) 'create three floats that are the (X,Y,Z) values of the point crvThreePt2 = Array(0.0, -40.0, 12.0) crvThreePt3 = Array(3.0, -30.0, 10.0) crvThreePt4 = Array(0.0, -20.0, 10.0) crvThreePt5 = Array(0.0, -10.0, 12.0) crvThreePt6 = Array(0.0, 0.0, 10.0) crvThreePt7 = Array(0.0, 10.0, 12.0) crvThreePt8 = Array(0.0, 20.0, 10.0) crvThreePt9 = Array(3.0, 30.0, 10.0) crvThreePt10 = Array(0.0, 40.0, 12.0) crvThreePt11 = Array(0.0, 50.0, 10.0) crvFourPt1 = Array(12.0, -50.0, 10.0) 'create three floats that are the (X,Y,Z) values of the point crvFourPt2 = Array(12.0, -40.0, 12.0) crvFourPt3 = Array(9.0, -30.0, 10.0) crvFourPt4 = Array(12.0, -20.0, 10.0) crvFourPt5 = Array(12.0, -10.0, 12.0) crvFourPt6 = Array(12.0, 0.0, 10.0) crvFourPt7 = Array(12.0, 10.0, 12.0) crvFourPt8 = Array(12.0, 20.0, 10.0) crvFourPt9 = Array(9.0, 30.0, 10.0) crvFourPt10 = Array(12.0, 40.0, 12.0) crvFourPt11 = Array(12.0, 50.0, 10.0) 'create arcs above my structure crvArcaPt1 = Array(0.0, -50, 10.0) 'create three floats that are the (X,Y,Z) values of the point crvArcaPt2 = Array(0.0, -20.0, 30.0) crvArcaPt3 = Array(0.0, 20.0, 30.0) crvArcaPt4 = Array(0.0, 50.0, 10.0) crvArcbPt1 = Array(12.0, -50, 10.0) 'create three floats that are the (X,Y,Z) values of the point crvArcbPt2 = Array(12.0, -20.0, 30.0) crvArcbPt3 = Array(12.0, 20.0, 30.0) crvArcbPt4 = Array(12.0, 50.0, 10.0) 'create peatonal bridge crvArccPt1 = Array(4.0, -50, 15.0) 'create three floats that are the (X,Y,Z) values of the point crvArccPt2 = Array(4.0, -20.0, 32.0) crvArccPt3 = Array(4.0, 20.0, 32.0) crvArccPt4 = Array(4.0, 50.0, 15.0) crvArcdPt1 = Array(8.0, -50, 15.0) 'create three floats that are the (X,Y,Z) values of the point crvArcdPt2 = Array(8.0, -20.0, 32.0) crvArcdPt3 = Array(8.0, 20.0, 32.0) crvArcdPt4 = Array(8.0, 50.0, 15.0) 'create a base crvBaseaPt1 = Array(2.0, -50.0, 5.0) 'create two floats that are the (X,Y,Z) values of the point crvBaseaPt2 = Array(0.0, -40.0, 7.0) crvBaseaPt3 = Array(2.0, -30.0, 5.0) crvBaseaPt4 = Array(0.0, -20.0, 7.0) crvBaseaPt5 = Array(2.0, -10.0, 5.0) crvBaseaPt6 = Array(0.0, 0.0, 3.0) crvBaseaPt7 = Array(2.0, 10.0, 5.0) crvBaseaPt8 = Array(0.0, 20.0, 7.0) crvBaseaPt9 = Array(2.0, 30.0, 5.0) crvBaseaPt10 = Array(0.0, 40.0, 7.0) crvBaseaPt11 = Array(2.0, 50.0, 5.0) crvBasebPt1 = Array(10.0, -50.0, 5.0) 'create two floats that are the (X,Y,Z) values of the point crvBasebPt2 = Array(12.0, -40.0, 7.0) crvBasebPt3 = Array(10.0, -30.0, 5.0) crvBasebPt4 = Array(12.0, -20.0, 7.0) crvBasebPt5 = Array(10.0, -10.0, 5.0) crvBasebPt6 = Array(12.0, 0.0, 3.0) crvBasebPt7 = Array(10.0, 10.0, 5.0) crvBasebPt8 = Array(12.0, 20.0, 7.0) crvBasebPt9 = Array(10.0, 30.0, 5.0) crvBasebPt10 = Array(12.0, 40.0, 7.0) crvBasebPt11 = Array(10.0, 50.0, 5.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 crvFive = Rhino.AddInterpCurve(Array(crvFivePt1, crvFivePt2, crvFivePt3, crvFivePt4)) 'Create first curve with array of points crvThree = Rhino.AddInterpCurve(Array(crvThreePt1, crvThreePt2, crvThreePt3, crvThreePt4, crvThreePt5, crvThreePt6, crvThreePt7, crvThreePt8, crvThreePt9, crvThreePt10, crvThreePt11)) 'Create second curve with array of points crvFour = Rhino.AddInterpCurve(Array(crvFourPt1, crvFourPt2, crvFourPt3, crvFourPt4, crvFourPt5, crvFourPt6, crvFourPt7, crvFourPt8, crvFourPt9, crvFourPt10, crvFourPt11)) 'Create second curve with array of points crvArca =Rhino.AddInterpcurve(Array(crvArcaPt1, crvArcaPt2, crvArcaPt3, crvArcaPt4)) crvArcb =Rhino.AddInterpcurve(Array(crvArcbPt1, crvArcbPt2, crvArcbPt3, crvArcbPt4)) crvArcc =Rhino.AddInterpcurve(Array(crvArccPt1, crvArccPt2, crvArccPt3, crvArccPt4)) crvArcd =Rhino.AddInterpcurve(Array(crvArcdPt1, crvArcdPt2, crvArcdPt3, crvArcdPt4)) crvBasea =Rhino.AddInterpcurve(Array(crvBaseaPt1, crvBaseaPt2, crvBaseaPt3, crvBaseaPt4, crvBaseaPt5, crvBaseaPt6, crvBaseaPt7, crvBaseaPt8, crvBaseaPt9, crvBaseaPt10, crvBaseaPt11)) crvBaseb =Rhino.AddInterpcurve(Array(crvBasebPt1, crvBasebPt2, crvBasebPt3, crvBasebPt4, crvBasebPt5, crvBasebPt6, crvBasebPt7, crvBasebPt8, crvBasebPt9, crvBasebPt10, crvBasebPt11)) 'Use the built curves to build bridge 'Call makeBridge(crvOne, crvTwo) 'Call makeBridge(crvThree, crvFour) 'makebridge from surfaces Dim curveArray curveArray = Array(crvOne, crvTwo, crvThree, crvFour) Rhino.AddEdgeSrf (curveArray) curveArray = Array(crvOne, crvThree, crvFour, crvFive) Rhino.AddEdgeSrf (curveArray) curveArray = Array(crvBasea, crvThree) Rhino.AddEdgeSrf (curveArray) curveArray = Array(crvBaseb, crvFour) Rhino.AddEdgeSrf (curveArray) curveArray = Array(crvArca, crvArcc) Rhino.AddEdgeSrf (curveArray) curveArray = Array(crvArcb, crvArcd) Rhino.AddEdgeSrf (curveArray) curveArray = Array(crvBasea, crvBaseb) Rhino.AddEdgeSrf (curveArray) End Function '**************************************** '===== FUNCTION FOR YOU TO CODE ========= '**************************************** '=======MAKEBRIDGE FUNCTION======================================= 'This function uses the two curves from above function to build 'your bridge '================================================================= Function makeBridge(c1, c2) 'In this function body you will be responsible for using the 'two curves c1 and c2 above which are passed as parameters 'to build your bridge 'you are allowed to use as many helper functions as necessary 'Concentrate on keeping your solution simple in the beginning 'you are welcome to elaborate on your design after you have something 'working End Function makeCurves Dim i Dim Uval1 Dim params1 Dim point1 Dim crv1 crv1=Rhino.GetObject("Get object",4) params1=Rhino.curveDomain(crv1) 'params1(0)=Umin 'params1(1)=Umax For i=0 To 15 Uval1=((params1(1)-params1(0))/16)*(i+1) point1=Rhino.evaluatecurve(crv1,uval1) Call Rhino.Addsphere(point1,1.0) Next Dim u Dim Uval2 Dim params2 Dim point2 Dim crv2 crv2=Rhino.GetObject("Get object",4) params2=Rhino.curveDomain(crv2) 'params2(0)=Umin 'params2(1)=Umax For u=0 To 15 Uval2=((params2(1)-params2(0))/16)*(u+1) point2=Rhino.evaluatecurve(crv2,uval2) Call Rhino.Addsphere(point2,1.0) Next