##################################### ### DM2_w24 # AGruber@tugraz.at ### ### hu_02_setup # alice_and_bob ### ##################################### ############################## import rhinoscriptsyntax as rs import random ############################## rs.UnitSystem(4) rs.ShowGrid(view=None, show=0) rs.ShowGridAxes(view=None, show=1) rs.EnableRedraw(1) rs.ViewDisplayMode(view=None, mode="Ghosted") rs.Command("-printDisplay State=On enter", 0) rs.ShowObjects(rs.AllObjects()) rs.DeleteObjects( rs.AllObjects() ) rs.CurrentLayer("Default") print "\t ********\**/************" print "\t **********\/entanglement" print "\t my quantum /\***********" print "\t***********/**\********* ver _2024 10 11 08:35\n\n", layNam = "MY_SETUP" rs.CurrentLayer(rs.AddLayer(layNam)) rs.LayerPrintColor(layNam, [100,100,100]) rs.LayerPrintWidth(layNam, 1.0) rs.ClearCommandHistory() #______base vectors randi = 100 vecA = [ random.uniform(-randi,randi), random.uniform(-randi,randi), random.uniform(-randi,-randi*1.5) ] vecB = [ random.uniform(-randi,randi), random.uniform(-randi,randi), random.uniform( randi, randi*1.5) ] #def myCoords( a=random.uniform(50,300), mov=vecA ): # coords = [[0,0,0], [a,0,0], [a,a,0], [0,a,0]] # rotXYZ = [ random.uniform(-30,30), random.uniform(-30,30), random.uniform(-30,30) ] # for i in range( len(coords) ): # coords[i] = rs.VectorAdd(coords[i], mov) # coords[i] = rs.VectorRotate(coords[i], 30, rotXYZ) # return coords #coords_A = myCoords(random.uniform(50,300), vecA) #coords_B = myCoords(random.uniform(50,300), vecB) #rs.AddPoints( coords_A+coords_B ) #rs.AddCurve ( coords_A, 1) #rs.AddCurve ( coords_B, 1) #rs.ZoomExtents() #for i,cor in enumerate(coords_A): rs.ObjectColor(rs.AddTextDot(str(i-(i>3)*4), cor), [200,200,0]) #for i,cor in enumerate(coords_B): rs.ObjectColor(rs.AddTextDot(str(i-(i>3)*4), cor), [0,200,200]) # rs.Sleep(1000) ##############################here you go: ########################################## ########################################## layNam = "MY_PROJECT" rs.CurrentLayer(rs.AddLayer(layNam)) rs.LayerPrintColor(layNam, [200,100,100]) #rs.LayerVisible("MY_SETUP", 0) rs.ZoomExtents() rs.Command("-printDisplay State=Off enter", 0) rs.CurrentLayer("Default") ############################# ##########################here you go ####2.hu ####domen jug ####gruppe gruber 3 ####20241015 #x1= 10 #y1= 15 #z1= 45 #x2= 10 #y2= 20 #z2= 40 #x3= 15 #y3= 15 #z3= 25 #for x in range(x1): # for y in range(y1): # for z in range(z1): # cor1 = [x,y,z] # coords1.append(cor1) #points1 = rs.AddPoints(coords1) coords = [] for i in range(5000): x = random.uniform(0,25) y = random.uniform(0,25) z = random.uniform(100,125) x = x - 15 y = y - 10 z = z - 20 coords.append([x,y,z]) points = rs.AddPoints(coords) spherecoords = [] radius = 25 for j in range(5000): x = random.uniform(-radius, radius) y = random.uniform(-radius, radius) z = random.uniform(-radius, radius) if (x**2 + y**2 + z**2) <= radius**2: spherecoords.append([x,y,z]) spherepoints = rs.AddPoints(spherecoords) for i in range(min(len(points), len(spherepoints))): startpoi = points[i] endpoi = spherepoints[i] rs.AddLine(startpoi, endpoi) for point in spherepoints: clr = [0,0,random.randint(100,235)] rs.ObjectColor(point, clr) for point2 in points: clr2 = [0,random.randint(100,200),0] rs.ObjectColor(point2, clr2) ##############################here you end ########################################## ########################################## ###################### #______4_lazy_experts: if 0: import time rs.ZoomExtents() rs.Command("-zoom Factor 0.95 enter", 0) rs.Redraw() from datetime import datetime #print str(datetime.now())[0:19] #print datetime.now().strftime('%a %b / %d.%m.%Y um %Huhr und %Mmin und %Ssec') print "\tdate", print time.ctime(), "==", print time.time(), "seconds since 1 January 1970" if 0: ### capture images to P:\ path = "P:/ue_02/images/" ### if there is no folder like this: check your desktop name = "tst" rs.Command("-viewCaptureToFile Width=480 Height=360 Scale=1.5 TransparentBackground=Yes "+path+name, 0) name = name+"_"+str(int(time.time()))+".jpg" rs.Command("-viewCaptureToFile Width=480 Height=360 Scale=2 DrawGrid=No DrawWorldAxes=No DrawCPlaneAxes=No TransparentBackground=No "+path+name, 0) print path+name