Date:2015-01-21 06:46:29 (9 years 2 months ago)
Author:Werner Almesberger
Commit:4d084a6191cb4542ff65e99b03cc37445e26d699
Message:sfc/slicer.py: new option -o to add an offset to the last layer

Files: sfc/slicer.py (5 diffs)

Change Details

sfc/slicer.py
3333            # negative). Default: use model dimensions.
3434align_top = None # align the Z position of the model to the workpiece
3535align_bottom = None
36end = 0 # Z adjustment of final layer
3637
3738
3839def dist(a, b):
...... 
9293def usage():
9394    print >>sys.stderr, "usage:", sys.argv[0], \
9495        "[-a (top|bottom)(+|-)offset] [-f] [-h height]" + \
95        "\t[-b piece_distance] [-s max_step] file.stl"
96        "\t[-b piece_distance] [-o z_offset] [-s max_step] file.stl"
9697    sys.exit(1)
9798
9899
...... 
105106os.dup2(2, 1)
106107sys.stdout = os.fdopen(stdout, "w")
107108
108opts, args = getopt.getopt(sys.argv[1:], "a:fh:p:s:")
109opts, args = getopt.getopt(sys.argv[1:], "a:e:fh:p:s:")
109110for opt, arg in opts:
110111    if opt == "-a":
111112        if arg[0:3] == "top":
...... 
114115            align_bottom = float(arg[6:])
115116        else:
116117            usage()
118    elif opt == "-o":
119        end = float(arg)
117120    elif opt == "-f":
118121        flip = True
119122    elif opt == "-h":
...... 
213216    last_z = None
214217if height is not None and height < 0 and z_levels[-1] > height:
215218    z_levels.append(height - z_off)
216
219
220z_levels[-1] += end
221
217222for next_z in z_levels:
218223    wires = shape.slice(Base.Vector(0, 0, 1), next_z + epsilon)
219224    if z_step is None or last_z is None or last_z - z_step <= next_z:

Archive Download the corresponding diff file

Branches:
master



interactive