Commit 18cd4748 authored by Jayant Khatkar's avatar Jayant Khatkar
Browse files

plot contours by arm assigned function (#71)

parent 0c7dac46
**/__pycache__/ **/__pycache__/
.DS_Store
*.pyc *.pyc
*.pkl *.pkl
*.so *.so
......
...@@ -17,9 +17,9 @@ if __name__ == "__main__": ...@@ -17,9 +17,9 @@ if __name__ == "__main__":
# load plan address from args # load plan address from args
parser = argparse.ArgumentParser(description='to watch, visulise and inspect loaded plans') parser = argparse.ArgumentParser(description='to watch, visulise and inspect loaded plans')
parser.add_argument('plan', parser.add_argument('plan')
metavar='plan',
help='plan to read') parser.add_argument('--gcode')
args = parser.parse_args() args = parser.parse_args()
# load plan # load plan
...@@ -28,3 +28,7 @@ if __name__ == "__main__": ...@@ -28,3 +28,7 @@ if __name__ == "__main__":
print("plan loaded, it is {}s long".format(plan.len())) print("plan loaded, it is {}s long".format(plan.len()))
print("use plan.watch(x) to watch the plan in 3D") print("use plan.watch(x) to watch the plan in 3D")
print("use plan.visualise(x) to plot plan") print("use plan.visualise(x) to plot plan")
if args.gcode is not None:
contours = gc.decode_gcode(args.gcode)
print("Contours loaded into variable contours")
...@@ -436,3 +436,21 @@ def get_tracker(model): ...@@ -436,3 +436,21 @@ def get_tracker(model):
print("Dependency graph completed and saved to " + pkl) print("Dependency graph completed and saved to " + pkl)
return tracker return tracker
def plot_plan_contours(plan, contours, colors=['black','magenta'], style='2d'):
"""
wrapper for plotting contours
"""
sorted_contours = []
for r in plan.trajs:
sorted_contours.append([])
for traj in plan.trajs[r]:
if traj.contour is not None:
sorted_contours[r].append(contours[traj.contour])
if style=='2d':
gc.plot_contours2d(*sorted_contours, colors=colors)
elif style=='3d':
gc.plot_contours3d(*sorted_contours, colors=colors)
else:
raise Exception("style must be '2d' or '3d'")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment