Commit fe2768f3 by Jayant Khatkar

### infill working but needs to be offset from sides

parent f0cbf0d4
 ... @@ -103,12 +103,16 @@ class solver: ... @@ -103,12 +103,16 @@ class solver: return self.layer.subs([(sym, val), (self.cz, layer*self.dz)]) return self.layer.subs([(sym, val), (self.cz, layer*self.dz)]) def sample(self, expression, sym_in, res = 0.001): def sample(self, expression, sym_in, res = 0.001, lims = None): """ """ sample across one variable, get values of second variable in an expression sample across one variable, get values of second variable in an expression """ """ v1 = np.arange(self.range[sym_in][0], self.range[sym_in][1]+ res, res) if lims is None: lims = self.range[sym_in] v1 = np.arange(lims[0], lims[1] + res, res) zs = [] zs = [] for v in v1: for v in v1: zs.append(float(expression.subs(sym_in, v))) zs.append(float(expression.subs(sym_in, v))) ... @@ -188,7 +192,7 @@ class solver: ... @@ -188,7 +192,7 @@ class solver: return one contour for the infill return one contour for the infill if n is even, the infill for that layer is parallel to the x-axis if n is even, the infill for that layer is parallel to the x-axis """ """ # Get the direction to print in # Get the direction to print in if n%2 == 0: if n%2 == 0: main = self.x main = self.x ... @@ -212,7 +216,15 @@ class solver: ... @@ -212,7 +216,15 @@ class solver: direction = True direction = True for row in main_vals[1:]: for row in main_vals[1:]: # TODO link to the next row # Connection to next row if main is self.y: expr1 = self.plane_intersection(other, poses[-1][0], layer = n) os, zs = self.sample(expr1, main, lims = (row - density, row)) poses += [Position(poses[-1][0], os[i], zs[i]) for i in range(len(os))] else: expr1 = self.plane_intersection(other, poses[-1][1], layer = n) os, zs = self.sample(expr1, main, lims = (row - density, row)) poses += [Position(os[i], poses[-1][1], zs[i]) for i in range(len(os))] expr1 = self.plane_intersection(main, row, layer = n) expr1 = self.plane_intersection(main, row, layer = n) os, zs = self.sample(expr1, other) os, zs = self.sample(expr1, other) ... @@ -245,11 +257,12 @@ class solver: ... @@ -245,11 +257,12 @@ class solver: if __name__ == '__main__': if __name__ == '__main__': s = solver(0.02, 100, 100, 0.003) s = solver(0.02, 100, 100, 0.01) contours = [] o_contours = [] i_contours = [] for i in np.arange(-15,55): for i in np.arange(-15,55): contours += s.contour_n(i) o_contours += s.contour_n(i) contours += s.infill_contour(i, 0.02) i_contours += s.infill_contour(i, 0.02) plot_contours(contours) plot_contours(o_contours, i_contours)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!