##################################### ### 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 _2022 10 14 11:25\n\n", print(" ____||____") print(" ///////////\\") print(" /////////// \\") print(" | _ | |") print(" |[] | | []|[]|") print(" | | | | |") layNam = "AMKOS_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+coords_b, 1) rs.ZoomExtents() for i,cor in enumerate(coords_a+coords_b): rs.ObjectColor(rs.AddTextDot(str(i-(i>3)*4), cor), [200,0,200]) rs.Sleep(1000) ##############################here you go: ########################################## ########################################## layNam = "AMKOS_PROJECT" rs.CurrentLayer(rs.AddLayer(layNam)) rs.LayerPrintColor(layNam, [200,100,100]) rs.LayerVisible("AMKOS_SETUP", 0) rs.ZoomExtents() rs.Command("-printDisplay State=Off enter", 0) rs.CurrentLayer("Default") #curve1 rs.AddPoint( [0,0,0] ) rs.AddPoint( [10,0,10] ) a = 10.33 p0 = [0,0,0] p1 = [a,0,0] p2 = [a,a,0] p3 = [0,a,0] coords = [p0, p1,p2,p3, p0] rs.DeleteObjects( rs.AllObjects() ) #random.shuffle( coords ) crv_1 = rs.AddCurve( coords, degree=1 ) #rs.AddCurve( coords, 2 ) #rs.AddCurve( coords ) #konstruktion von spiegelung der crv_1 p4 = [0,0,a] p5 = [0,a,a] coords2 = [p0, p4, p5, p3] crv_2 = rs.AddCurve( coords2, degree=1) sp = [a/2, 0 ,0] ep = [a/2, a, 0] rs.MirrorObject(crv_2, sp, ep, copy=1) #durch rotate befehl restliches quadrat erschaffen rs.RotateObject(crv_2, [a/2, a/2,0], 90, axis=None, copy=1) rs.RotateObject(crv_2, [a/2, a/2,0], -90, axis=None, copy=1) #firstdachkante crv_3 = rs.AddCurve([sp, ep], degree=1) crv_3new = rs.MoveObject(crv_3, [ 0,0,13 ]) #konstruktion der dachschraegen p_sp = [a/2, 0, 13] p_ep = [a/2, a, 13] crv_sp = rs.AddCurve([ p4, p_sp ], degree=1) crv_ep = rs.AddCurve( [p5, p_ep], degree=1 ) rs.MirrorObject([crv_sp, crv_ep], p_sp, p_ep, copy=1) print "schoenes hausi" ##############################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