Skip to content

Instantly share code, notes, and snippets.

@kscottz
Created December 9, 2014 00:31
Show Gist options
  • Save kscottz/2060356168646fbb2e8a to your computer and use it in GitHub Desktop.
Save kscottz/2060356168646fbb2e8a to your computer and use it in GitHub Desktop.
def _parse_variable_tray(self,config):
# for a variable tray we allocate the rows
# at run time as needed
tl_x = config["points"]["tl"]["x"]
tl_y = config["points"]["tl"]["y"]
br_x = config["points"]["br"]["x"]
br_y = config["points"]["br"]["y"]
self.row_tl = [tl_x,tl_y]
self.row_br = [br_x,br_y]
x_off = config["offsets"]["x"]
y_off = config["offsets"]["y"]
self.offsets = [x_off,y_off]
pos = self.top_left()
y_top = self.row_tl[1]+pos[1]
y_bottom = self.row_br[1]+pos[1]
x_start = self.row_tl[0]+pos[0]
x_stop = self.row_br[0]+pos[0]
x_pts = np.linspace(x_start,x_stop,tray.self.part_rows)
count = len(x_pts)
ymin = (np.ones([1,count])*y_top)[0].tolist()
ymax = (np.ones([1,count])*y_bottom)[0].tolist()
state = ["free" for i in range(0,count)]
# MWAHAHAHAHA!!!
# list of [["state",((start_x,start_y),(stop_x,stop_y))]]
self.slots = zip(state,zip(zip(x_pts,ymin),zip(x_pts,ymax)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment