############################## ### DM2_w24 hu_03_setUp ### ### _diag / 2024 10 17 ### ############################## import rhinoscriptsyntax as rs import random, time, sys ### sys.path.append("P:/WWW/ortii/DM2") ### add path where "DM_lib.py" can be found !!! import DM_lib as dm ### reload(dm) ############################## rs.UnitSystem(3) rs.ShowGrid(view=None, show=0) #rs.ShowGridAxes(view=None, show=0) rs.ViewDisplayMode(view=None, mode="Wireframe") rs.EnableRedraw(0) dm.PointRadius(displayModeX=0, rad=2, styl=1) rs.DeleteObjects(rs.AllObjects()) anz = random.choice( range(2**4, 2**8, 4) ) rad1 = random.uniform(5.0, 10) rad2 = random.uniform(5.0, 10) vec1 = [rad1, 0,0] vec2 = [rad2, 0,0] random_color1 = [random.uniform(0, 255), random.uniform(0, 255), random.uniform(0, 255) ] random_color2 = [random.uniform(0, 255), random.uniform(0, 255), random.uniform(0, 255) ] random_color3 = [random.uniform(0, 255), random.uniform(0, 255), random.uniform(0, 255) ] deltaAngle = 360/anz center1 = [random.randint(0, 10), random.randint(0, 10), random.randint(0, 10)] center2 = [random.randint(0, 10), random.randint(0, 10), random.randint(0, 10)] for i in range(anz**2): #**2 fuer eine groessere dichte vecX = rs.VectorRotate(vec1, deltaAngle*i, dm.pntRandVec(-1,1)[0] ) vecX = rs.VectorScale( vecX, random.uniform(0, 1) ) vecX = rs.VectorAdd( vecX, center1 ) rs.VectorUnitize( vecX) points_1 = rs.AddPoint( vecX) rs.ObjectColor(points_1, random_color1) for j in range(anz**2): #**2 fuer eine groessere dichte vecY = rs.VectorRotate(vec2, deltaAngle*j, dm.pntRandVec(-1,1)[0] ) vecY = rs.VectorScale( vecY, random.uniform(0, 1) ) vecY = rs.VectorAdd( vecY, center2 ) rs.VectorUnitize( vecY) points_2 = rs.AddPoint( vecY) rs.ObjectColor(points_2, random_color2) l = random.randint(5, 10) d = random.randint(5, 10) coords_c1 = [] for x in range(l): x = x + d for y in range(l): y = y + d for z in range(l): z = z + d cor_c1 = [x, y, z] coords_c1.append(cor_c1) cubepnt1 = rs.AddPoints(coords_c1) rs.ObjectColor(cubepnt1, random_color3) print "*** **********" print "*** anz =", anz print "*** rad1 =", rad1 print "*** rad2 =", rad2 print "*** center1 =", center1 print "*** center2 =", center2 print "*** **********\n" rs.ZoomExtents()