def main(): skNum = (datetime.date.today()-datetime.date(2020, 03, 28)).days + 201 if int(skNum) > int(os.path.splitext(os.path.basename(__file__))[0]): print "!!!!SAVE THE SKETCH WITH A NEW NAME!!!!" rs.UnselectAllObjects() init_time = time.time() version = 'a' anim = mp4.Animation(os.path.splitext(os.path.basename(__file__))[0] + version) numFrames = 200 numPasses = 200 anim.fps = 30 td = TempDisplay() display = HUD(os.path.splitext(os.path.basename(__file__))[0], numFrames) s = Scene() ################################ #SETUP ballSystem = System() ################################ for i in range(numFrames): start_time = time.time() print "Frame {}".format(i) if sc.escape_test(False): anim.Cleanup(); return ################################ #MAIN LOOP ballSystem.Update() ################################ #HUD #display.UpdateParam1('x: ' + str(ball.pos.X)) #display.UpdateParam2('y: ' + str(ball.pos.Y)) #display.UpdateParam3('z: ' + str(ball.pos.Z)) display.UpdateScaleBar() ################################ sc.doc.Views.Redraw() display.Update(i) anim.AddFrame(numberOfPasses = numPasses) #if result: # break ################################ #Framerate frameTime = time.time() - start_time timeLeft = (numFrames - i) * frameTime timeLeftStr = str(datetime.timedelta(seconds=timeLeft)) print "Time remaining: {}".format(timeLeftStr) frameTime = time.time() - init_time timeLeftStr = str(datetime.timedelta(seconds=frameTime)) print "Total Time: {}".format(timeLeftStr) if os.path.isdir(r"D:\Files\Work\LIBRARY\06_RHINO\10_Python\300 DAYS\anim"): anim.Create(r"D:\Files\Work\LIBRARY\06_RHINO\10_Python\300 DAYS\anim", frames2Keep = [i/2, i-1]) else: anim.Create(r"C:\Tim\300 Days\anim", frames2Keep = [i/2, i-1])
def main(): startDate = None init_time = time.time() version = 'a' anim = mp4.Animation( os.path.splitext(os.path.basename(__file__))[0] + version) numFrames = 150 numPasses = 200 anim.fps = 30 td = TempDisplay() display = HUD(os.path.splitext(os.path.basename(__file__))[0], numFrames) s = Scene() ################################ #SETUP ball = Ball() ################################ for i in range(numFrames): start_time = time.time() print "Frame {}".format(i) if sc.escape_test(False): anim.Cleanup() return ################################ #MAIN LOOP ball.Update() ################################ #HUD display.UpdateParam1('x: ' + str(ball.pos.X)) display.UpdateParam2('y: ' + str(ball.pos.Y)) display.UpdateParam3('z: ' + str(ball.pos.Z)) display.UpdateScaleBar() ################################ sc.doc.Views.Redraw() display.Update(i) anim.AddFrame(numberOfPasses=numPasses) #if result: # break ################################ #Framerate frameTime = time.time() - start_time timeLeft = (numFrames - i) * frameTime timeLeftStr = str(datetime.timedelta(seconds=timeLeft)) print "Time remaining: {}".format(timeLeftStr) frameTime = time.time() - init_time timeLeftStr = str(datetime.timedelta(seconds=frameTime)) print "Total Time: {}".format(timeLeftStr) if os.path.isdir( r"D:\Files\Work\LIBRARY\06_RHINO\10_Python\300 DAYS\anim"): anim.Create(r"D:\Files\Work\LIBRARY\06_RHINO\10_Python\300 DAYS\anim", frames2Keep=[i / 2, i - 1]) else: anim.Create(r"C:\Tim\300 Days\anim", frames2Keep=[i / 2, i - 1])
def main(): skNum = (datetime.date.today() - datetime.date(2020, 03, 29)).days + 201 if int(skNum) > int(os.path.splitext(os.path.basename(__file__))[0]): print "!!!!SAVE THE SKETCH WITH A NEW NAME!!!!" rs.UnselectAllObjects() init_time = time.time() version = 'a' anim = mp4.Animation( os.path.splitext(os.path.basename(__file__))[0] + version) numFrames = 150 numPasses = 100 anim.fps = 30 td = TempDisplay() display = HUD(os.path.splitext(os.path.basename(__file__))[0], numFrames) s = Scene() ################################ #SETUP targets = [] vSystems = [] for i in range(5): targets.append(geo.Particle(geo.RandomPoint(), geo.RandomVector3d(5))) targets[-1].radius = 5 for i in range(5): print(i * .05) + .3 vSystems.append(VoxelSystem(targets, i * .05 + .3)) ################################ for i in range(numFrames): start_time = time.time() print "Frame {}".format(i) if sc.escape_test(False): anim.Cleanup() return ################################ #MAIN LOOP for target in targets: target.Update() for vSystem in vSystems: vSystem.Update() vSystem.UpdateDisplay() ################################ #HUD #display.UpdateParam1('boxes: ' + str(len(bSystem.boxes))) #display.UpdateParam2('links: ' + str(len(bSystem.links))) #display.UpdateParam3('z: ' + str(ball.pos.Z)) display.UpdateScaleBar() ################################ sc.doc.Views.Redraw() display.Update(i) anim.AddFrame(numberOfPasses=numPasses) rs.Sleep(500) ################################ #Framerate frameTime = time.time() - start_time timeLeft = (numFrames - i) * frameTime timeLeftStr = str(datetime.timedelta(seconds=timeLeft)) print "Time remaining: {}".format(timeLeftStr) frameTime = time.time() - init_time timeLeftStr = str(datetime.timedelta(seconds=frameTime)) print "Total Time: {}".format(timeLeftStr) if int(skNum) > int(os.path.splitext(os.path.basename(__file__))[0]): print "!!!!SAVE THE SKETCH WITH A NEW NAME!!!!" if os.path.isdir( r"D:\Files\Work\LIBRARY\06_RHINO\10_Python\300 DAYS\anim"): anim.Create(r"D:\Files\Work\LIBRARY\06_RHINO\10_Python\300 DAYS\anim", frames2Keep=[i / 2, i - 1]) else: anim.Create(r"C:\Tim\300 Days\anim", frames2Keep=[i / 2, i - 1])
def main(): skNum = (datetime.date.today() - datetime.date(2020, 03, 29)).days + 201 if int(skNum) > int(os.path.splitext(os.path.basename(__file__))[0]): print "!!!!SAVE THE SKETCH WITH A NEW NAME!!!!" rs.UnselectAllObjects() init_time = time.time() version = 'a' anim = mp4.Animation( os.path.splitext(os.path.basename(__file__))[0] + version) numFrames = 150 numPasses = 100 anim.fps = 30 td = TempDisplay() display = HUD(os.path.splitext(os.path.basename(__file__))[0], numFrames) s = Scene() ################################ #SETUP pt = rg.Point3d(10, 50, 70) vec = rg.Vector3d(0, -10, 10) plane = rg.Plane(pt, vec) xint = rg.Interval(0, 80) yint = rg.Interval(0, 80) zint = rg.Interval(0, 40) xcount = 50 ycount = 50 zcount = 20 box = rg.Box(plane, xint, yint, zint) #m = rg.Mesh.CreateFromBox(box, xcount, ycount, zcount) m = rg.Mesh.CreateFromPlane(plane, xint, yint, xcount, ycount) mObj = vSystem(m) ################################ for i in range(numFrames): start_time = time.time() print "Frame {}".format(i) if sc.escape_test(False): anim.Cleanup() return ################################ #MAIN LOOP if i % 5 == 0: mObj.Update() mObj.UpdateDisplay() ################################ #HUD #display.UpdateParam1('boxes: ' + str(len(bSystem.boxes))) #display.UpdateParam2('links: ' + str(len(bSystem.links))) #display.UpdateParam3('z: ' + str(ball.pos.Z)) display.UpdateScaleBar() ################################ sc.doc.Views.Redraw() display.Update(i) anim.AddFrame(numberOfPasses=numPasses) rs.Sleep(500) ################################ #Framerate frameTime = time.time() - start_time timeLeft = (numFrames - i) * frameTime timeLeftStr = str(datetime.timedelta(seconds=timeLeft)) print "Time remaining: {}".format(timeLeftStr) frameTime = time.time() - init_time timeLeftStr = str(datetime.timedelta(seconds=frameTime)) print "Total Time: {}".format(timeLeftStr) if int(skNum) > int(os.path.splitext(os.path.basename(__file__))[0]): print "!!!!SAVE THE SKETCH WITH A NEW NAME!!!!" if os.path.isdir( r"D:\Files\Work\LIBRARY\06_RHINO\10_Python\300 DAYS\anim"): anim.Create(r"D:\Files\Work\LIBRARY\06_RHINO\10_Python\300 DAYS\anim", frames2Keep=[i / 2, i - 1]) else: anim.Create(r"C:\Tim\300 Days\anim", frames2Keep=[i / 2, i - 1])
def main(): skNum = (datetime.date.today() - datetime.date(2020, 03, 29)).days + 201 if int(skNum) > int(os.path.splitext(os.path.basename(__file__))[0]): print "!!!!SAVE THE SKETCH WITH A NEW NAME!!!!" rs.UnselectAllObjects() init_time = time.time() version = 'c' anim = mp4.Animation( os.path.splitext(os.path.basename(__file__))[0] + version) numFrames = 150 numPasses = 100 anim.fps = 30 td = TempDisplay() display = HUD(os.path.splitext(os.path.basename(__file__))[0], numFrames) s = Scene() ################################ #SETUP #bSystem = BoxSystem() #pSystem = ParticleSystem() #mesh = rg.Mesh() ptObjs = [] vecObjs = [] pts = [] ids = [] for i in range(10): pos = rg.Point3d(random.uniform(0, 100), random.uniform(0, 100), random.uniform(0, 100)) ptObjs.append(PointObj(pos, geo.RandomVector3d(1))) ptObjs[-1].size = 4 pts.append(pos) ################################ for i in range(numFrames): start_time = time.time() print "Frame {}".format(i) if sc.escape_test(False): anim.Cleanup() return ################################ #MAIN LOOP for id in ids: sc.doc.Objects.Delete(id, True) pts = [] for ptObj in ptObjs: ptObj.Update() ptObj.UpdateDisplay() pts.append(ptObj.pos) h = Hull(pts) for edge in h.edges: ids.append(Pipe(pts, edge, 4)) ################################ #HUD #display.UpdateParam1('boxes: ' + str(len(bSystem.boxes))) #display.UpdateParam2('links: ' + str(len(bSystem.links))) #display.UpdateParam3('z: ' + str(ball.pos.Z)) display.UpdateScaleBar() ################################ sc.doc.Views.Redraw() display.Update(i) anim.AddFrame(numberOfPasses=numPasses) rs.Sleep(500) ################################ #Framerate frameTime = time.time() - start_time timeLeft = (numFrames - i) * frameTime timeLeftStr = str(datetime.timedelta(seconds=timeLeft)) print "Time remaining: {}".format(timeLeftStr) frameTime = time.time() - init_time timeLeftStr = str(datetime.timedelta(seconds=frameTime)) print "Total Time: {}".format(timeLeftStr) if int(skNum) > int(os.path.splitext(os.path.basename(__file__))[0]): print "!!!!SAVE THE SKETCH WITH A NEW NAME!!!!" if os.path.isdir( r"D:\Files\Work\LIBRARY\06_RHINO\10_Python\300 DAYS\anim"): anim.Create(r"D:\Files\Work\LIBRARY\06_RHINO\10_Python\300 DAYS\anim", frames2Keep=[i / 2, i - 1]) else: anim.Create(r"C:\Tim\300 Days\anim", frames2Keep=[i / 2, i - 1])