Skip to content

Instantly share code, notes, and snippets.

@petejohanson
Created May 11, 2022 13:58
Show Gist options
  • Save petejohanson/32543c6391cfd7d51a50f5df88309baf to your computer and use it in GitHub Desktop.
Save petejohanson/32543c6391cfd7d51a50f5df88309baf to your computer and use it in GitHub Desktop.
def load_points():
stream = open(f"{file_dir}/output/points/points.yaml", "r")
points = yaml.safe_load(stream)
return points
def points_with_tag(tag, points=load_points()):
filtered = [x for x in points.values() if x["meta"].get("tags") and x["meta"]["tags"].get(tag)]
return filtered
def point_to_tuple(point):
return (point['x'], point['y'])
def screw_points():
return list(map(point_to_tuple, points_with_tag("screw_hole")))
def key_points():
return points_with_tag("keys")
def key_point_tuples():
return list(map(point_to_tuple, key_points()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment