def print_object(): display = projector() lift = BED_servo(Z_DISTANCE_PER_STEP) try: slice_stats = expand_slice_directions() setup_resin(display, lift) start_time = time.time() for i in xrange(NUM_SLICES): display_status(start_time, i) method, display_time = slice_stats[i] slice_image = SLICE_PREFIX+"{:04d}.png".format(i) if method == "dip": display.black() lift.move_microns(DIP_DISTANCE, DIP_SPEED_DOWN) time.sleep(DIP_WAIT) lift.move_microns(-DIP_DISTANCE+SLICE_THICKNESS, DIP_SPEED_UP) time.sleep(RESIN_SETTLE) display.display(slice_image) time.sleep(display_time) elif method == "cont": display.display(slice_image) lift.move_microns(SLICE_THICKNESS, SLICE_THICKNESS / display_time) elif method == "bottom": display.display(slice_image) time.sleep(display_time) elif method == "slow dip": display.black() lift.move_microns(SLOW_DIP_DIST, SLOW_DIP_SPEED) time.sleep(DIP_WAIT) lift.move_microns(-SLOW_DIP_DIST+SLICE_THICKNESS, SLOW_DIP_SPEED) time.sleep(RESIN_SETTLE) display.display(slice_image) time.sleep(display_time) print "Print completed in " + time.strftime('%H:%M:%S', time.gmtime(time.time()-start_time)) except: traceback.print_exception(*sys.exc_info()) display.black() lift.home(OPTIMUM_LIFT_SPEED) lift.shutdown() display.shutdown()
def print_object(): display = projector() lift = BED_servo(Z_DISTANCE_PER_STEP) try: slice_stats = expand_slice_directions() setup_resin(display, lift) start_time = time.time() for i in xrange(NUM_SLICES): display_status(start_time, i) method, display_time = slice_stats[i] slice_image = SLICE_PREFIX + "{:04d}.png".format(i) if method == "dip": display.black() lift.move_microns(DIP_DISTANCE, DIP_SPEED_DOWN) time.sleep(DIP_WAIT) lift.move_microns(-DIP_DISTANCE + SLICE_THICKNESS, DIP_SPEED_UP) time.sleep(RESIN_SETTLE) display.display(slice_image) time.sleep(display_time) elif method == "cont": display.display(slice_image) lift.move_microns(SLICE_THICKNESS, SLICE_THICKNESS / display_time) elif method == "bottom": display.display(slice_image) time.sleep(display_time) elif method == "slow dip": display.black() lift.move_microns(SLOW_DIP_DIST, SLOW_DIP_SPEED) time.sleep(DIP_WAIT) lift.move_microns(-SLOW_DIP_DIST + SLICE_THICKNESS, SLOW_DIP_SPEED) time.sleep(RESIN_SETTLE) display.display(slice_image) time.sleep(display_time) print "Print completed in " + time.strftime("%H:%M:%S", time.gmtime(time.time() - start_time)) except: traceback.print_exception(*sys.exc_info()) display.black() lift.home(OPTIMUM_LIFT_SPEED) lift.shutdown() display.shutdown()
def calibrate(): display = projector() lift = BED_servo(Z_DISTANCE_PER_STEP) try: setup_resin(display, lift) start_time = time.time() for i in xrange(NUM_SLICES): display_status(start_time, i) lift.move_microns(DIP_DISTANCE, DIP_SPEED_DOWN) time.sleep(DIP_WAIT) lift.move_microns(-DIP_DISTANCE + SLICE_THICKNESS, DIP_SPEED_UP) time.sleep(RESIN_SETTLE) display.display(SLICE_PREFIX + "0000.png") if i < FIRST_SLICE_NUM: time.sleep(FIRST_SLICE_TIME) else: time.sleep(CALIBRATE_MIN_TIME) for j in xrange(1, 9): display.display(SLICE_PREFIX + "{:04d}.png".format(j)) time.sleep(CALIBRATE_TIME_DELTA) display.black() print "Print completed in " + time.strftime("%H:%M:%S", time.gmtime(time.time() - start_time)) except: traceback.print_exception(*sys.exc_info()) lift.home(OPTIMUM_LIFT_SPEED) lift.shutdown() display.shutdown()
def calibrate(): display = projector() lift = BED_servo(Z_DISTANCE_PER_STEP) try: setup_resin(display, lift) start_time = time.time() for i in xrange(NUM_SLICES): display_status(start_time,i) lift.move_microns(DIP_DISTANCE, DIP_SPEED_DOWN) time.sleep(DIP_WAIT) lift.move_microns(-DIP_DISTANCE+SLICE_THICKNESS, DIP_SPEED_UP) time.sleep(RESIN_SETTLE) display.display(SLICE_PREFIX+"0000.png") if i < FIRST_SLICE_NUM: time.sleep(FIRST_SLICE_TIME) else: time.sleep(CALIBRATE_MIN_TIME) for j in xrange(1,9): display.display(SLICE_PREFIX+"{:04d}.png".format(j)) time.sleep(CALIBRATE_TIME_DELTA) display.black() print "Print completed in " + time.strftime('%H:%M:%S', time.gmtime(time.time()-start_time)) except: traceback.print_exception(*sys.exc_info()) lift.home(OPTIMUM_LIFT_SPEED) lift.shutdown() display.shutdown()
def print_object(): display = projector() lift = BED_servo(Z_DISTANCE_PER_STEP) try: setup_resin(display, lift) start_time = time.time() for i in xrange(NUM_SLICES): display_status(start_time, i) display.display(SLICE_PREFIX+"{:04d}.png".format(i)) if i < FIRST_SLICE_NUM: lift.move_microns(SLICE_THICKNESS, FIRST_SLICE_LIFT_SPEED) else: lift.move_microns(SLICE_THICKNESS, LIFT_SPEED) print "Print completed in " + time.strftime('%H:%M:%S', time.gmtime(time.time()-start_time)) except: traceback.print_exception(*sys.exc_info()) display.black() lift.home(OPTIMUM_LIFT_SPEED) lift.shutdown() display.shutdown()
except KeyboardInterrupt: print '^C received, shutting down the web server' server.socket.close() # Runs the web server thread thread.start_new_thread(WebServerThread,()) iremote = IRemote() iremote.add_listener(my_iremote_handler) iremote.start() theRelay = relay() player = iTunes() alarm = wecker(player,theRelay) alarm.start() beamer = projector() room = my_hue() #theTimer = sleeptimer(player,theRelay) print 'Remote catch up and running' while True: try: if alarm_set and not alarm.alarm_set: alarm.set_time(alarm_time) #alarm_set = True #alarm_on = True if not alarm_set and alarm.alarm_set: alarm.alarm_set = False print 'alarm caceled' #alarm_set = False alarm_set = alarm.alarm_set
def supercali(): display = projector() lift = BED_servo(Z_DISTANCE_PER_STEP) try: setup_resin(display, lift) start_time = time.time() base_num_slices = (SUPERCALI_BASE_HEIGHT - FIRST_SLICE_THICKNESS) / SLICE_THICKNESS + 1 base_num_slices = 0 # ~ for i in xrange(base_num_slices): # ~ display_status(start_time,i) # ~ if i < FIRST_SLICE_NUM: # ~ thickness = FIRST_SLICE_THICKNESS # ~ display_time = FIRST_SLICE_TIME # ~ else: # ~ thickness = SLICE_THICKNESS # ~ display_time = SLICE_DISPLAY_TIME # ~ if i == FIRST_SLICE_NUM: # ~ dip_speed = 100 # ~ else: # ~ dip_speed = DIP_SPEED_DOWN # ~ lift.move_microns(DIP_DISTANCE, dip_speed) # ~ time.sleep(DIP_WAIT) # ~ lift.move_microns(-DIP_DISTANCE+thickness, DIP_SPEED_UP) # ~ time.sleep(RESIN_SETTLE) # ~ display.display(SLICE_PREFIX+"base.png") # ~ time.sleep(display_time) # ~ display.black() post_num_slices = SUPERCALI_POST_HEIGHT / SLICE_THICKNESS for i in xrange(post_num_slices): display_status(start_time, i + base_num_slices) lift.move_microns(DIP_DISTANCE, DIP_SPEED_DOWN) time.sleep(DIP_WAIT) lift.move_microns(-DIP_DISTANCE + SLICE_THICKNESS, DIP_SPEED_UP) time.sleep(RESIN_SETTLE) display.display(SLICE_PREFIX + "0000.png") time.sleep(SUPERCALI_MIN_TIME) for j in xrange(1, 9): display.display(SLICE_PREFIX + "{:04d}.png".format(j)) time.sleep(SUPERCALI_TIME_DELTA) display.black() print "Print completed in " + time.strftime("%H:%M:%S", time.gmtime(time.time() - start_time)) except: traceback.print_exception(*sys.exc_info()) lift.home(OPTIMUM_LIFT_SPEED) lift.shutdown() display.shutdown()
def supercali(): display = projector() lift = BED_servo(Z_DISTANCE_PER_STEP) try: setup_resin(display, lift) start_time = time.time() base_num_slices = (SUPERCALI_BASE_HEIGHT-FIRST_SLICE_THICKNESS)/SLICE_THICKNESS + 1 base_num_slices = 0 #~ for i in xrange(base_num_slices): #~ display_status(start_time,i) #~ if i < FIRST_SLICE_NUM: #~ thickness = FIRST_SLICE_THICKNESS #~ display_time = FIRST_SLICE_TIME #~ else: #~ thickness = SLICE_THICKNESS #~ display_time = SLICE_DISPLAY_TIME #~ if i == FIRST_SLICE_NUM: #~ dip_speed = 100 #~ else: #~ dip_speed = DIP_SPEED_DOWN #~ lift.move_microns(DIP_DISTANCE, dip_speed) #~ time.sleep(DIP_WAIT) #~ lift.move_microns(-DIP_DISTANCE+thickness, DIP_SPEED_UP) #~ time.sleep(RESIN_SETTLE) #~ display.display(SLICE_PREFIX+"base.png") #~ time.sleep(display_time) #~ display.black() post_num_slices = SUPERCALI_POST_HEIGHT/SLICE_THICKNESS for i in xrange(post_num_slices): display_status(start_time,i+base_num_slices) lift.move_microns(DIP_DISTANCE, DIP_SPEED_DOWN) time.sleep(DIP_WAIT) lift.move_microns(-DIP_DISTANCE+SLICE_THICKNESS, DIP_SPEED_UP) time.sleep(RESIN_SETTLE) display.display(SLICE_PREFIX+"0000.png") time.sleep(SUPERCALI_MIN_TIME) for j in xrange(1,9): display.display(SLICE_PREFIX+"{:04d}.png".format(j)) time.sleep(SUPERCALI_TIME_DELTA) display.black() print "Print completed in " + time.strftime('%H:%M:%S', time.gmtime(time.time()-start_time)) except: traceback.print_exception(*sys.exc_info()) lift.home(OPTIMUM_LIFT_SPEED) lift.shutdown() display.shutdown()