import rhinoscriptsyntax as rs import random, time, sys ### sys.path.append("P:/") ### add path where "DM_lib.py" can be found !!! import DM_lib as dm ### reload(dm) def add_copy_and_rotate_point(point, rotation_center=(0, 0, 0), angles=[90, 180, 270], axis=(0, 0, 1)): point_id = rs.AddPoint(point) for i, angle in enumerate(angles): copied_point = rs.CopyObject(point_id) rs.RotateObject(copied_point, rotation_center, angle, axis) def generate_points_and_rotate(num_points=300, rotation_angles=[90, 180, 270], rotation_axis=(0, 0, 1)): coords = [] allCoords = dm.setUp_hu_03(25) #print allCoords[0] rs.AddPoints( allCoords[0] ) coordsCir = allCoords[0] cen = dm.pntCentroid(coordsCir) rs.AddCurve( [ cen, coordsCir[0] ] ) dm.textDots( coordsCir ) dm.eA() #dm.setUp_hu_03( if 0: allCoords = dm.setUp_hu_03(anzahl=11) #print allCoords[0] rs.AddPoints( allCoords[0] ) coordsCir = allCoords[0] cen = dm.pntCentroid(coordsCir) rs.AddCurve( [ cen, coordsCir[0] ] ) rs.AddCurve( allCoords[1], 1 ) dm.textDots( coordsCir ) dm.textDots( allCoords[1] ) #### kreis #rs.AddPoint( vec ) anz = 500 rad = 5.0 center = [random.randint(26,26),26,26] deltaAngle = 360/anz vec = [1, 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) add_copy_and_rotate_point(vecX) anz = 350 rad = 1.0 center = [random.randint(-1,-1),-1,-1] deltaAngle = 360/anz vec = [1, 0, 0] for i in range(anz): angX = deltaAngle*i #print angX vecX = rs.VectorRotate( vec, angX , [random.uniform(-15,15),random.uniform(-15,15),random.uniform(-15,15)] ) #vector, angle_degrees, axis) vecX = rs.VectorScale( vecX, random.uniform( 5,rad) ) vecX = rs.VectorAdd( vecX, center) add_copy_and_rotate_point(vecX) coords=[] print coords for i in range(300): #print i x=random.uniform(0,17) y=random.uniform(0,17) z=random.uniform(0,17) x+= +11 y+= +8 z+= +8 cor = [x,y,z] rs.AddPoint(cor) #rs.ZoomExtents() coords. append (cor) add_copy_and_rotate_point(vecX) #print "i=",i, coords #for angle in rotation_angles: #for point in coords: #copied_point = rs.CopyObject(rs.AddPoint(point)) #rs.RotateObject(copied_point, (0, 0, 0), angle, rotation_axis) #generate_points_and_rotate(num_points=300) #irgendwie geht dieser befehl nicht..... hilfe? coords=[] print coords for i in range(250): #print i x=random.uniform(15,25) y=random.uniform(15,25) z=random.uniform(15,25) x+= +13 y+= +10 z+= +10 cor = [x,y,z] rs.AddPoint(cor) #rs.ZoomExtents() coords. append (cor) #print "i=",i, coords add_copy_and_rotate_point(vecX) anz = 340 rad = 5.0 center = [random.randint(9,9),9,9] deltaAngle = 360/anz vec = [1, 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) add_copy_and_rotate_point(vecX) coords=[] print coords for i in range(200): #print i x=random.uniform(0,10) y=random.uniform(0,10) z=random.uniform(0,10) x+= +0 y+= +0 z+= +0 cor = [x,y,z] rs.AddPoint(cor) #rs.ZoomExtents() coords. append (cor) #print "i=",i, coords add_copy_and_rotate_point(vecX) anz = 300 rad = 5.0 center = [random.randint(40,40),35,35] deltaAngle = 360/anz vec = [1, 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( 7,rad) ) vecX = rs.VectorAdd( vecX, center) add_copy_and_rotate_point(vecX) coords=[] print coords for i in range(450): #print i x=random.uniform(30,50) y=random.uniform(30,50) z=random.uniform(30,50) x+= +7 y+= +6 z+= +6 cor = [x,y,z] rs.AddPoint(cor) #rs.ZoomExtents() coords. append (cor) #print "i=",i, coords add_copy_and_rotate_point(vecX) anz = 280 rad = 5.0 center = [random.randint(57,57),57,57] deltaAngle = 360/anz vec = [1, 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( 10,rad) ) vecX = rs.VectorAdd( vecX, center) add_copy_and_rotate_point(vecX) coords=[] anz = 150 rad = 5.0 center = [random.randint(40,40),57,57] deltaAngle = 360/anz vec = [1, 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) add_copy_and_rotate_point(vecX) coords=[] nz = 200 rad = 5.0 center = [random.randint(57,57),40,57] deltaAngle = 360/anz vec = [1, 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) add_copy_and_rotate_point(vecX) coords=[] anz = 150 rad = 5.0 center = [random.randint(40,40),40,57] deltaAngle = 360/anz vec = [1, 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) add_copy_and_rotate_point(vecX) coords=[] anz = 190 rad = 5.0 center = [random.randint(12,12),26,26] deltaAngle = 360/anz vec = [1, 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( 2,rad) ) vecX = rs.VectorAdd( vecX, center) add_copy_and_rotate_point(vecX) anz = 260 rad = 5.0 center = [random.randint(26,26),12,26] deltaAngle = 360/anz vec = [1, 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( 2,rad) ) vecX = rs.VectorAdd( vecX, center) add_copy_and_rotate_point(vecX) anz = 190 rad = 5.0 center = [random.randint(12,12),26,12] deltaAngle = 360/anz vec = [1, 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( 2,rad) ) vecX = rs.VectorAdd( vecX, center) add_copy_and_rotate_point(vecX) anz = 210 rad = 5.0 center = [random.randint(26,26),11,11] deltaAngle = 360/anz vec = [1, 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( 2,rad) ) vecX = rs.VectorAdd( vecX, center) add_copy_and_rotate_point(vecX)