def make_area_for_roughing(k): num_spans = kurve.num_spans(k) if num_spans == 0: raise "sketch has no spans!" d, startx, starty, ex, ey, cx, cy = kurve.get_span(k, 0) d, sx, sy, endx, endy, cx, cy = kurve.get_span(k, num_spans - 1) a = area.new() largey = 500 for span in range(0, num_spans): d, sx, sy, ex, ey, cx, cy = kurve.get_span(k, span) if span == 0: # first span area.add_point(a, 0, startx, largey, 0, 0) area.add_point(a, 0, startx, starty, 0, 0) area.add_point(a, d, ex, ey, cx, cy) # close the area area.add_point(a, 0, endx, largey, 0, 0) area.add_point(a, 0, startx, largey, 0, 0) return a
def make_area_for_roughing(k): num_spans = kurve.num_spans(k) if num_spans == 0: raise Exception("sketch has no spans!") d, startx, starty, ex, ey, cx, cy = kurve.get_span(k, 0) d, sx, sy, endx, endy, cx, cy = kurve.get_span(k, num_spans - 1) a = area.new() largey = 500 for span in range(0, num_spans): d, sx, sy, ex, ey, cx, cy = kurve.get_span(k, span) if span == 0:# first span area.add_point(a, 0, startx, largey, 0, 0) area.add_point(a, 0, startx, starty, 0, 0) area.add_point(a, d, ex, ey, cx, cy) # close the area area.add_point(a, 0, endx, largey, 0, 0) area.add_point(a, 0, startx, largey, 0, 0) return a
import area a = area.new() area.add_point(a, 0, 10, 10, 0, 0) area.add_point(a, 0, 30, 10, 0, 0) area.add_point(a, 0, 30, 30, 0, 0) area.add_point(a, 0, 10, 30, 0, 0) area.add_point(a, 0, 10, 10, 0, 0) area.offset(a, 3) for curve in range(0, area.num_curves(a)): for vertex in range(0, area.num_vertices(a, curve)): sp, x, y, cx, cy = area.get_vertex(a, curve, vertex) print sp, x, y, cx, cy