示例#1
0
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.Area()
    c = area.Curve()
    largey = 7

    for span in range(0, num_spans):
        d, sx, sy, ex, ey, cx, cy = kurve.get_span(k, span)
        if span == 0:  # first span
            c.append(
                area.Vertex(0, area.Point(startx, largey), area.Point(0, 0)))

        c.append(area.Vertex(d, area.Point(ex, ey), area.Point(cx, cy)))
    # close the area

    c.append(area.Vertex(0, area.Point(endx, largey), area.Point(0, 0)))
    c.append(area.Vertex(0, area.Point(startx, largey), area.Point(0, 0)))
    a.append(c)
    return a
示例#2
0
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
示例#3
0
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.Area()
    c = area.Curve()
    largey = 7
    
    for span in range(0, num_spans):
        d, sx, sy, ex, ey, cx, cy = kurve.get_span(k, span)
        if span == 0:# first span
            c.append(area.Vertex(0, area.Point(startx, largey), area.Point(0, 0)))

        c.append(area.Vertex(d, area.Point(ex, ey), area.Point(cx, cy)))
    # close the area

    c.append(area.Vertex(0, area.Point(endx, largey), area.Point(0, 0)))
    c.append(area.Vertex(0, area.Point(startx, largey), area.Point(0, 0)))
    a.append(c)
    return a
示例#4
0
文件: turning.py 项目: jb36/heekscnc
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