Created
May 11, 2022 13:58
-
-
Save petejohanson/32543c6391cfd7d51a50f5df88309baf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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