import rhinoscriptsyntax as rs
def convex_hull(points):
	start = min(points, key=lambda p: p[0])
	hull = [start]
	current = start
	while True:
		next_point = points[0]
		for point in points:
			if point == current:
				continue
			direction = (next_point[0] - current[0]) * (point[1] - current[1]) - (next_point[1] - current[1]) * (point[0] - current[0])
			if direction < 0 or next_point == current:
				next_point = point
		if next_point == start:
			break
		else:
			hull.append(next_point)
			current = next_point
	return hull
points = rs.GetPointCoordinates("Select points")
if points:
	hull = convex_hull(points)
	for i in range(len(hull)):
		rs.AddLine(hull[i], hull[(i + 1) % len(hull)])