#WS24 DM2 HUE4 Philipp Filipovic ################################################ import rhinoscriptsyntax as rs import random, time, sys sys.path.append("P:/WWW/filipovp/") import DM_lib as dm import random as rd, math #import math rs.EnableRedraw(0) dm.eA() ################################################ dm.PointRadius(displayModeX=0, rad=6, styl=0, verbose=0) dm.PointRadius(displayModeX=1, rad=10, styl=1, verbose=0) #Kugel if 1: length = 40 anz = 2000 # Punktanzahl rad = 30.0 # Kugelradius elevation = 35 # Hoehenlage der Kugel center = [0, 0, elevation] # Position der Kugel sphere_points = [] sphere_coords = [] for i in range(anz): dm.esc() theta = math.acos(1 - 2 * (i + 0.5) / anz) phi = math.pi * (1 + 5**0.5) * i x = rad * math.sin(theta) * math.cos(phi) y = rad * math.sin(theta) * math.sin(phi) z = rad * math.cos(theta) if (z + elevation) > length: pt = rs.AddPoint( rs.VectorAdd(center, [x, y, z]) ) sphere_points.append(pt) sphere_coords.append(rs.VectorAdd(center, [x, y, z])) for pt in sphere_points: dm.esc() rs.ObjectColor(pt, [200,200,200]) rs.Command("-SetObjectDisplayMode selID "+str(pt)+" enter \"shaded\" enter", 0) #centroidHalbSphere = dm.pntCentroid( sphere_coords ) # #for cor in sphere_points: # dm.esc() # #rs.AddLine( [100,0,0], cor ) # rs.AddLine( centroidHalbSphere, cor ) #Wuerfel #Seitenlaenge if 1: for i in range(-40,length): #Position aendern for j in range(-40,length): for k in range(0,length): if i% 3 == 0: ###Abstand zwischen Punkten aendern if j% 3 == 0: if k% 3 == 0: pnt = rs.CreatePoint(i,j,k) points = rs.AddPoint(pnt) rs.ObjectColor(points, [rd.uniform(0,255), rd.uniform(0,255), rd.uniform(0,255)]) #Kreis 1 anz = 121 arrPoint= [0,0,0] #Mittelpunkt Radius= 80 Kreis1 = rs.AddCircle (arrPoint,Radius) coords_1 = rs.DivideCurve(Kreis1, anz, create_points=0) ##(curve_id, segments, create_points=False, return_points=True) #rs.AddPoints( coords_1 ) #Kreis2 arrPoint= [0,0,40] Radius2= 80 Kreis2 = rs.AddCircle (arrPoint,Radius2) coords_2 = rs.DivideCurve(Kreis2, anz, create_points=0) ##(curve_id, segments, create_points=False, return_points=True) coords_2 += coords_2 coords_2 += coords_2 pScheitel = [0,0, elevation+rad] for i in range(anz): p1 = coords_1[i] p2 = coords_2[i+int(anz*0.1)] p3 = coords_2[i+int(anz*0.2)] rs.AddLine( p1, p2 ) rs.AddLine( p1, p3 ) #rs.AddLine(coords_2[i], center ) #rs.AddLine(coords_2[i], pScheitel ) ##K2Points = [] ## ##for p in range [50]: ## point = rs.GetPointOnCurve(Kreis2, "Point in curve") ## rs.AddPoint(point) ## points.append(point) rs.ZoomExtents()