diff --git a/cvr.py b/cvr.py index 681c0bf..48bb1ce 100755 --- a/cvr.py +++ b/cvr.py @@ -1,5 +1,8 @@ #!/usr/bin/python +import shape + + # # gnuplot the outline # @@ -10,6 +13,12 @@ def outline_gnuplot(points): print +def gnuplot_line(x0, y0, x1, y1): + print x0, y0 + print x1, y1 + print + + # # make a HeeksCAD sketch of the outline # @@ -47,7 +56,11 @@ def closed_outline(*args): def open_outline(*args): do(list(args)) - + +def line(*args): + do_line(*args) + + # # Make the cover sheet 2 mm larger than the counterweight on all sides. We need # the following exceptions to avoid mechanical interference: @@ -111,19 +124,42 @@ def outline(): def label(): + u = 2 + x = 40 + y = 66 # C open_outline( - 25+5, 55+10, - 25, 55+10, - 25, 55, - 25+5, 55) + x+u, y+2*u, + x, y+2*u, + x, y, + x+u, y) + + x += u*1.6 # W open_outline( - 33, 55+10, - 33, 55, - 33+2.5, 55+5, - 33+5, 55, - 33+5, 55+10) + x, y+2*u, + x, y, + x+0.5*u, y+u, + x+u, y, + x+u, y+2*u) + + +# ----- Counterweight outline ------------------------------------------------- + + +lines = [] + + +def rect_outline(x0, y0, z0, x1, y1, z1): + global lines + + lines.append((x0, y0, x0, y1)) + lines.append((x1, y0, x1, y1)) + lines.append((x0, y0, x1, y0)) + lines.append((x0, y1, x1, y1)) + + +# ----- Main ------------------------------------------------------------------ if __name__ == "__main__": @@ -134,3 +170,15 @@ else: outline() label() + +shape.rect = rect_outline +shape.make_base() + +if __name__ == "__main__": + for e in lines: + gnuplot_line(*e) +else: + cad.sketch() + sk = cad.getlastobj() + for e in lines: + cad_line(sk, *e)