import rhinoscriptsyntax as rs import random, sys sys.path.append("C:\Weronika\erasmus Graz\Digitale Methoden - Python\DM_lib") import DM_lib as dm #delete everything start from scratch allobj = rs.AllObjects() rs.DeleteObjects(allobj) offs1 = 2 #offset between points offs2 = 5 nb = 14 rs.EnableRedraw(False) newCoords = [] #cube for i in range(nb): for j in range(nb): for k in range(nb): if not (i>0 and j>0) or not(i<(nb-1) and j<(nb-1)): square = rs.AddPoint(i,j,k) # rs.MoveObjects(square, (i*offs1,j*offs1,k*offs1)) cor = [i,j,k] newCoords.append(cor) #random.shuffle(newCoords) rs.AddCurve(newCoords, 1) #sphere sphere_coords = [] anz = random.randint(10,3000) rad = 1.0 center = [random.randint(10,300), 26,114] deltaAngle = 360/anz vec = [10, 0, 0] for i in range(anz): angX = deltaAngle*i print angX vecX = rs.VectorRotate( vec, angX , [random.uniform(-1,1),random.uniform(-1,1),random.uniform(-1,1)] ) #vector, angle_degrees, axis) vecX = rs.VectorScale( vecX, random.uniform( 5,rad) ) vecX = rs.VectorAdd( vecX, center) #sphere color pink rs.AddPoint( vecX ) sphere_points = rs.AddPoint(vecX) if sphere_points: sphere_coords.append(sphere_points) for sphere_points in sphere_coords: color = [255,0,255] rs.ObjectColor(sphere_points, color) rs.AddLine(square, sphere_points) rs.ZoomExtents()