'================================================================================================== ' Sub CurveLineUp v091117 '================================================================================================== '================================================================================================== Sub CurveLineUp arrObjects = Rhino.getobjects("curves",4) 'collection of curves intCurveCount = UBound(arrObjects) ' ----------------------------------------------- For i = 0 To intCurveCount - 1 strCurve1 = arrObjects(i) strCurve2 = arrObjects(i+1) arrPoint1 = Rhino.curveendpoint(strCurve1) arrPoint2 = Rhino.curveStartPoint(strCurve2) '1 line up the curves Rhino.moveObject strCurve2, arrPoint2, arrPoint1 Next ' ----------------------------------------------- For i = 0 To intCurveCount strCurve1 = arrObjects(i) '2 distribute curves to layers strLayerName = "_Curve__"&CStr(i) 'COLOR METHOD 1 : intLayerColor = Int ( RGB(255, 255, 255) * (i / intCurveCount)) 'COLOR METHOD 2 : gradient in red 'intLayerColor = RGB ( (255 * i / intCurveCount) ,0,0) 'COLOR METHOD 3 : gradient in greyscale 'intLayerColor = (255 * i / intCurveCount) 'intLayerColor = RGB(intLayerColor,intLayerColor,intLayerColor) Rhino.print "currentlayercolor for "& strCurve1 & " is "&CStr(intLayerColor) '-------------------------------------------------------------- 'if the layer does not exist in the drawing, then generate it. 'otherwise just change its color to intLayerColor. If Not Rhino.islayer (strLayerName) Then Rhino.addlayer strLayerName, intLayerColor Else Rhino.layercolor strLayerName, intLayerColor End If '-------------------------------------------------------------- '-------------------------------------------------------------- ' change the layer of the object : Rhino.objectlayer strCurve1, strLayerName 'here the layer of the curve is set '-------------------------------------------------------------- Next ' ----------------------------------------------- End Sub '==================================================================================================