Script execution

This commit is contained in:
gac-S_Changer
2017-07-11 09:45:17 +02:00
parent f9f0322b26
commit 8849c2eedf

View File

@@ -12,6 +12,8 @@ DET_MINISPINE = "minispine"
DET_ERROR = "error"
DET_EMPTY = "empty"
BLOCKS = ('A', 'B', 'C', 'D', 'E', 'F')
#Layout table
puck_layout = (
#Num Elm A0 Index A1 Uni Mini Center Angle Xuni Yuni Xmini=Xc Ymini==Yc
@@ -144,17 +146,26 @@ def get_blocks():
###################################################################################################
def detect_pucks(point_list, block_id=None):
for puck in get_pucks(block_id):
puck.detect = DET_ERROR
for point in point_list:
match = puck.match(point[0], point[1])
if match is not None:
if match==DET_UNIPUCK:
puck.detect = DET_EMPTY if (puck.detect==DET_MINISPINE) else DET_UNIPUCK
elif match==DET_MINISPINE:
puck.detect = DET_EMPTY if (puck.detect==DET_UNIPUCK) else DET_MINISPINE
def _detect_puck(point_list, puck):
puck.detect = DET_ERROR
for point in point_list:
match = puck.match(point[0], point[1])
if match is not None:
if match==DET_UNIPUCK:
puck.detect = DET_EMPTY if (puck.detect==DET_MINISPINE) else DET_UNIPUCK
elif match==DET_MINISPINE:
puck.detect = DET_EMPTY if (puck.detect==DET_UNIPUCK) else DET_MINISPINE
def detect_pucks(point_list, id=None):
if (id is None) or (id in BLOCKS):
for puck in get_pucks(block_id):
_detect_puck(point_list, puck)
else:
puck = get_puck(int(id))
print puck
_detect_puck(point_list, puck)
def clear_detection(block_id=None):
for puck in get_pucks(block_id):
puck.detect = DET_ERROR
@@ -239,7 +250,3 @@ def plot_base_plate(points = None, show_detect = True, title = None):
plot_cross(p,point[0], point[1], size = 10, width = w, color = c, name = "P"+ str(points.index(point)))
#plot_point(p,point[0], point[1], size = 5, color = Color.BLACK, name = "Pc"+ str(points.index(point)))
points = [(100, 140), (130, 77), (120, 130), (110, 100)]
detect_pucks(points)
plot_base_plate(points)