#DM2 Hue02 Tanja Konrad 9730734 # #01 with random points and curves print " ___ __ " print " / _ \ /_ |" print " | | | | | |" print " | | | | | |" print " | |_| | | |" print " \___/ |_| with random points and curves" import rhinoscriptsyntax as rs import random rs.EnableRedraw( 0 ) alleObjekte = rs.AllObjects() rs.DeleteObjects(alleObjekte) coords = [] coords_one = [] #ZERO with black hole #base of 0 h=20 for i in range(0,300): x_base = random.uniform(0,100) y_base = random.uniform(0,100) z_base = random.uniform(0,20) cor = [x_base,y_base,z_base] coords.append(cor) x_left = random.uniform(0,20) y_left = random.uniform(0,100) z_left = random.uniform(21,80) cor = [x_left,y_left,z_left] coords.append(cor) x_right = random.uniform(80,100) y_right = random.uniform(0,100) z_right = random.uniform(21,80) cor = [x_right,y_right,z_right] coords.append(cor) x_top = random.uniform(0,100) y_top = random.uniform(0,100) z_top = random.uniform(81,100) cor = [x_top,y_top,z_top] coords.append(cor) rs.AddPoints(coords) rs.AddCurve(coords, 1 ) random.shuffle( coords, ) newPoints = rs.AddPoints( coords ) #color randint(0..255) for pnt in newPoints : colo = [random.randint(0,255), random.randint(0,255), random.randint(0,255) ] rs.ObjectColor( pnt, colo ) rs.ZoomExtents() #ONE in Blau for i in range(0,800): x_one = random.uniform(130,160) y_one = random.uniform(0,100) z_one = random.uniform(0,100) r = random.randint(0,0) g = random.randint(0,0) b = random.randint(0,150) color = [r,g,b] coords_one = rs.AddPoint(x_one,y_one,z_one) rs.ObjectColor(coords_one, color) coords_front1 = [[0,0,0], [100,0,0], [100,0,100], [0,0,100], [0,0,0]] coords_front2 = [[130,0,0], [160,0,0], [160,0,100], [130,0,100], [130,0,0]] rs.AddPoints( coords_front1+coords_front2) rs.AddCurve ( coords_front1, 1) rs.AddCurve ( coords_front2, 1) rs.ZoomExtents() for i,cor in enumerate(coords_front1): rs.ObjectColor(rs.AddTextDot(str(i-(i>3)*4), cor), [170,0,150]) for i,cor in enumerate(coords_front2): rs.ObjectColor(rs.AddTextDot(str(i-(i>3)*4), cor), [130,0,150])