Change Details
sfc/slicer.py |
33 | 33 | # negative). Default: use model dimensions. |
34 | 34 | align_top = None # align the Z position of the model to the workpiece |
35 | 35 | align_bottom = None |
| 36 | end = 0 # Z adjustment of final layer |
36 | 37 | |
37 | 38 | |
38 | 39 | def dist(a, b): |
... | ... | |
92 | 93 | def usage(): |
93 | 94 | print >>sys.stderr, "usage:", sys.argv[0], \ |
94 | 95 | "[-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" |
96 | 97 | sys.exit(1) |
97 | 98 | |
98 | 99 | |
... | ... | |
105 | 106 | os.dup2(2, 1) |
106 | 107 | sys.stdout = os.fdopen(stdout, "w") |
107 | 108 | |
108 | | opts, args = getopt.getopt(sys.argv[1:], "a:fh:p:s:") |
| 109 | opts, args = getopt.getopt(sys.argv[1:], "a:e:fh:p:s:") |
109 | 110 | for opt, arg in opts: |
110 | 111 | if opt == "-a": |
111 | 112 | if arg[0:3] == "top": |
... | ... | |
114 | 115 | align_bottom = float(arg[6:]) |
115 | 116 | else: |
116 | 117 | usage() |
| 118 | elif opt == "-o": |
| 119 | end = float(arg) |
117 | 120 | elif opt == "-f": |
118 | 121 | flip = True |
119 | 122 | elif opt == "-h": |
... | ... | |
213 | 216 | last_z = None |
214 | 217 | if height is not None and height < 0 and z_levels[-1] > height: |
215 | 218 | z_levels.append(height - z_off) |
216 | | |
| 219 | |
| 220 | z_levels[-1] += end |
| 221 | |
217 | 222 | for next_z in z_levels: |
218 | 223 | wires = shape.slice(Base.Vector(0, 0, 1), next_z + epsilon) |
219 | 224 | if z_step is None or last_z is None or last_z - z_step <= next_z: |
Download the corresponding diff file