{ "nodes": [ { "datums": [ { "expr": "-1", "name": "xmin", "type": "float", "uid": 0 }, { "expr": "1", "name": "xmax", "type": "float", "uid": 1 }, { "expr": "-1", "name": "ymin", "type": "float", "uid": 2 }, { "expr": "1", "name": "ymax", "type": "float", "uid": 3 }, { "expr": "-1", "name": "zmin", "type": "float", "uid": 4 }, { "expr": "1", "name": "zmax", "type": "float", "uid": 5 }, { "expr": "60", "name": "x_period", "type": "float", "uid": 6 }, { "expr": "60", "name": "y_period", "type": "float", "uid": 7 }, { "expr": "60", "name": "z_period", "type": "float", "uid": 8 }, { "expr": "0.2", "name": "thickness", "type": "float", "uid": 9 }, { "expr": "\u0012fab.types.Shape('a= abs( sin(X/0.10471975511965977) * sin(Y/0.10471975511965977) * sin(Z/0.10471975511965977) + sin(X/0.10471975511965977) * cos(Y/0.10471975511965977) * cos(Z/0.10471975511965977) + cos(X/0.10471975511965977) * sin(X/0.10471975511965977) * cos(Z/0.10471975511965977) + cos(X/0.10471975511965977) * cos(Y/0.10471975511965977) * sin(Z/0.10471975511965977)) - 0.2;am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f-1Z-Zf1',float('-1.000000'),float('-1.000000'),float('-1.000000'),float('1.000000'),float('1.000000'),float('1.000000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 10 } ], "inspector": [ -144.671875, -178 ], "name": "s0", "script": [ "import fab", "import math", "", "#http://en.wikipedia.org/wiki/Schwarz_minimal_surface", "title('Schwarz Diamond')", "", "input('xmin', float)", "input('xmax', float)", "input('ymin', float)", "input('ymax', float)", "input('zmin', float)", "input('zmax', float)", "", "input('x_period', float)", "input('y_period', float)", "input('z_period', float)", "input('thickness', float)", "", "x_factor = 2 * math.pi / x_period", "y_factor = 2 * math.pi / y_period", "z_factor = 2 * math.pi / z_period", "", "fn = \"= abs( sin(X/%(x_factor)s) * sin(Y/%(y_factor)s) * sin(Z/%(z_factor)s) + sin(X/%(x_factor)s) * cos(Y/%(y_factor)s) * cos(Z/%(z_factor)s) + cos(X/%(x_factor)s) * sin(X/%(x_factor)s) * cos(Z/%(z_factor)s) + cos(X/%(x_factor)s) * cos(Y/%(y_factor)s) * sin(Z/%(z_factor)s)) - %(thickness)s;\" % locals()", "", "output('shape', fab.shapes.function_prefix_xyz(fn, xmin, xmax,", " ymin, ymax,", " zmin, zmax))", "" ], "uid": 0 }, { "datums": [ { "expr": "0.0", "name": "x", "type": "float", "uid": 0 }, { "expr": "0.0", "name": "y", "type": "float", "uid": 1 }, { "expr": "0.0", "name": "z", "type": "float", "uid": 2 }, { "expr": "1", "name": "r", "type": "float", "uid": 3 }, { "expr": "\u0012fab.types.Shape('-r++qXqYqZf1',float('-1.000000'),float('-1.000000'),float('-1.000000'),float('1.000000'),float('1.000000'),float('1.000000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 4 } ], "inspector": [ 154.875, -297 ], "name": "s1", "script": [ "import fab", "import math", "", "title('Sphere (center)')", "", "input('x', float)", "input('y', float)", "input('z', float)", "input('r', float)", "", "output('shape', fab.shapes.sphere(x, y, z, r))", "", "# UI", "sb.ui.wireframe([", " (math.cos(i/36. * 2*math.pi) * r + x,", " math.sin(i/36. * 2*math.pi) * r + y, z)", " for i in range(36)], close=True)", "sb.ui.wireframe([(x,y,z-r), (x,y,z+r)])", "", "sb.ui.point(x, y, z)", "sb.ui.point(x, y, z + r, drag=(None, None, r))", "sb.ui.point(x, y, z - r, drag=(None, None, r))", "" ], "uid": 1 }, { "datums": [ { "expr": "\u0011[__4.__2]", "name": "a", "type": "_fabtypes.Shape", "uid": 0 }, { "expr": "\u0011[__0.__10]", "name": "b", "type": "_fabtypes.Shape", "uid": 1 }, { "expr": "\u0012fab.types.Shape('aa-r++qXqYqZf1n-r++qXqYqZf0.9a= abs( sin(X/0.10471975511965977) * sin(Y/0.10471975511965977) * sin(Z/0.10471975511965977) + sin(X/0.10471975511965977) * cos(Y/0.10471975511965977) * cos(Z/0.10471975511965977) + cos(X/0.10471975511965977) * sin(X/0.10471975511965977) * cos(Z/0.10471975511965977) + cos(X/0.10471975511965977) * cos(Y/0.10471975511965977) * sin(Z/0.10471975511965977)) - 0.2;am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f-1Z-Zf1',float('-1.000000'),float('-1.000000'),float('-1.000000'),float('1.000000'),float('1.000000'),float('1.000000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 2 } ], "inspector": [ -137, 197 ], "name": "i0", "script": [ "import fab.types", "", "title('Intersection')", "input('a', fab.types.Shape)", "input('b', fab.types.Shape)", "", "output('shape', a & b)", "" ], "uid": 2 }, { "datums": [ { "expr": "0.0", "name": "x", "type": "float", "uid": 0 }, { "expr": "0.0", "name": "y", "type": "float", "uid": 1 }, { "expr": "0.0", "name": "z", "type": "float", "uid": 2 }, { "expr": "0.9", "name": "r", "type": "float", "uid": 3 }, { "expr": "\u0012fab.types.Shape('-r++qXqYqZf0.9',float('-0.900000'),float('-0.900000'),float('-0.900000'),float('0.900000'),float('0.900000'),float('0.900000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 4 } ], "inspector": [ 154, -108 ], "name": "s2", "script": [ "import fab", "import math", "", "title('Sphere (center)')", "", "input('x', float)", "input('y', float)", "input('z', float)", "input('r', float)", "", "output('shape', fab.shapes.sphere(x, y, z, r))", "", "# UI", "sb.ui.wireframe([", " (math.cos(i/36. * 2*math.pi) * r + x,", " math.sin(i/36. * 2*math.pi) * r + y, z)", " for i in range(36)], close=True)", "sb.ui.wireframe([(x,y,z-r), (x,y,z+r)])", "", "sb.ui.point(x, y, z)", "sb.ui.point(x, y, z + r, drag=(None, None, r))", "sb.ui.point(x, y, z - r, drag=(None, None, r))", "" ], "uid": 3 }, { "datums": [ { "expr": "\u0011[__1.__4]", "name": "a", "type": "_fabtypes.Shape", "uid": 0 }, { "expr": "\u0011[__3.__4]", "name": "b", "type": "_fabtypes.Shape", "uid": 1 }, { "expr": "\u0012fab.types.Shape('a-r++qXqYqZf1n-r++qXqYqZf0.9',float('-1.000000'),float('-1.000000'),float('-1.000000'),float('1.000000'),float('1.000000'),float('1.000000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 2 } ], "inspector": [ 156, 79 ], "name": "d0", "script": [ "import fab.types", "", "title('Difference')", "input('a', fab.types.Shape)", "input('b', fab.types.Shape)", "", "output('shape', a & ~b)", "" ], "uid": 4 }, { "datums": [ { "expr": "0", "name": "x", "type": "float", "uid": 0 }, { "expr": "0", "name": "y", "type": "float", "uid": 1 }, { "expr": "0.0", "name": "z", "type": "float", "uid": 2 }, { "expr": "\u0011[__2.__2]", "name": "shape", "type": "_fabtypes.Shape", "uid": 3 }, { "expr": "\u0012fab.types.Shape('m-Xf0-Yf0-Zf0aa-r++qXqYqZf1n-r++qXqYqZf0.9a= abs( sin(X/0.10471975511965977) * sin(Y/0.10471975511965977) * sin(Z/0.10471975511965977) + sin(X/0.10471975511965977) * cos(Y/0.10471975511965977) * cos(Z/0.10471975511965977) + cos(X/0.10471975511965977) * sin(X/0.10471975511965977) * cos(Z/0.10471975511965977) + cos(X/0.10471975511965977) * cos(Y/0.10471975511965977) * sin(Z/0.10471975511965977)) - 0.2;am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f-1Z-Zf1',float('-1.000000'),float('-1.000000'),float('-1.000000'),float('1.000000'),float('1.000000'),float('1.000000'))", "name": "out", "type": "_fabtypes.Shape", "uid": 4 } ], "inspector": [ 157.20028606782114, 752.94086081301589 ], "name": "r0", "script": [ "import fab", "", "title('Recenter')", "", "input('x', float)", "input('y', float)", "input('z', float)", "", "input('shape', fab.types.Shape)", "output('out', fab.shapes.recenter(shape, x, y, z))", "", "# UI", "sb.ui.wireframe([(x, y - 0.3, z),", " (x, y + 0.3, z)], color=sb.color.teal)", "sb.ui.wireframe([(x - 0.3, y, z),", " (x + 0.3, y, z)], color=sb.color.teal)", "sb.ui.wireframe([(x, y, z - 0.3),", " (x, y, z + 0.3)], color=sb.color.teal)", "", "sb.ui.point(x, y, z, color=sb.color.teal)", "" ], "uid": 5 }, { "datums": [ { "expr": "0", "name": "x", "type": "float", "uid": 0 }, { "expr": "0", "name": "y", "type": "float", "uid": 1 }, { "expr": "0", "name": "z", "type": "float", "uid": 2 }, { "expr": "2", "name": "width", "type": "float", "uid": 3 }, { "expr": "1", "name": "height", "type": "float", "uid": 4 }, { "expr": "\u0012fab.types.Shape('m+f0/*-Xf0f1+*f0-Zf0*f1-f1Z+f0/*-Yf0f1+*f0-Zf0*f1-f1Z_am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f0Z-Zf1',float('-1.000000'),float('-1.000000'),float('0.000000'),float('1.000000'),float('1.000000'),float('1.000000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 5 } ], "inspector": [ 508.40575660494693, -159.00403310180883 ], "name": "p0", "script": [ "# Neil Gershenfeld 1/24/15 ", "# Matt Keeter 5/31/15", "", "import math", "import fab", "", "title('Pyramid (center)')", "", "input('x', float)", "input('y', float)", "input('z', float)", "input('width', float)", "input('height', float)", "", "output('shape', fab.shapes.pyramid(x - width/2, x + width/2,", " y - width/2, y + width/2,", " z, z + height))", "", "# UI", "def drag_w(this, x, y, z):", " dx = x - this.x", " dy = y - this.y", " this.width = math.sqrt(2) * math.sqrt(dx**2 +dy**2)", "", "sb.ui.wireframe([(x, y, z+height), (x, y, z), (x + width/2, y + width/2, z)])", "sb.ui.point(x, y, z)", "sb.ui.point(x + width/2, y + width/2, z, drag=drag_w, relative=False)", "sb.ui.point(x, y, z + height, drag=(None, None, height))", "", "" ], "uid": 12 }, { "datums": [ { "expr": "0", "name": "x0", "type": "float", "uid": 0 }, { "expr": "0", "name": "y0", "type": "float", "uid": 1 }, { "expr": "0.0", "name": "_z", "type": "float", "uid": 2 }, { "expr": "2", "name": "sx", "type": "float", "uid": 3 }, { "expr": "0.5", "name": "sy", "type": "float", "uid": 4 }, { "expr": "\u0011[__7.__5]", "name": "shape", "type": "_fabtypes.Shape", "uid": 5 }, { "expr": "\u0012fab.types.Shape('m+f0/-Xf0f2+f0/-Yf0f0.5_m-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107Y+*f-0.707107X*f0.707107Y_m-Xf-0-Yf-0-Zf0m+f0/*-Xf0f1+*f0-Zf0*f1-f1Z+f0/*-Yf0f1+*f0-Zf0*f1-f1Z_am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f0Z-Zf1',float('-2.828428'),float('-0.707107'),float('0.000000'),float('2.828428'),float('0.707107'),float('1.000000'))", "name": "scaled", "type": "_fabtypes.Shape", "uid": 6 } ], "inspector": [ 491.82460491029906, 276.87903683839062 ], "name": "s3", "script": [ "# Neil Gershenfeld 1/24/15", "# Matt Keeter 5/31/15", "", "import fab", "", "title('Scale (2D)')", "", "input('x0', float)", "input('y0', float)", "input('_z', float)", "input('sx', float)", "input('sy', float)", "", "input('shape', fab.types.Shape)", "output('scaled', fab.shapes.scale_xy(shape, x0, y0, sx, sy))", "", "# UI", "sb.ui.wireframe([(x0 + sx, y0, _z), (x0, y0, _z), (x0, y0 + sy, _z)],", " color=sb.color.teal)", "sb.ui.wireframe([(x0 + sx, y0 + sx/10, _z), (x0 + sx, y0 - sx/10, _z)],", " color=sb.color.teal)", "sb.ui.wireframe([(x0 + sy/10, y0 + sy, _z), (x0 - sy/10, y0 + sy, _z)],", " color=sb.color.teal)", "sb.ui.point(x0, y0, _z, color=sb.color.teal)", "sb.ui.point(x0 + sx, y0, _z, color=sb.color.teal, drag=(sx, None, None))", "sb.ui.point(x0, y0 + sy, _z, color=sb.color.teal, drag=(None, sy, None))", "" ], "uid": 6 }, { "datums": [ { "expr": "0.0", "name": "x", "type": "float", "uid": 0 }, { "expr": "0.0", "name": "y", "type": "float", "uid": 1 }, { "expr": "0.0", "name": "_z", "type": "float", "uid": 2 }, { "expr": "45", "name": "a", "type": "float", "uid": 3 }, { "expr": "\u0011[__12.__5]", "name": "shape", "type": "_fabtypes.Shape", "uid": 4 }, { "expr": "\u0012fab.types.Shape('m-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107Y+*f-0.707107X*f0.707107Y_m-Xf-0-Yf-0-Zf0m+f0/*-Xf0f1+*f0-Zf0*f1-f1Z+f0/*-Yf0f1+*f0-Zf0*f1-f1Z_am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f0Z-Zf1',float('-1.414214'),float('-1.414214'),float('0.000000'),float('1.414214'),float('1.414214'),float('1.000000'))", "name": "rotated", "type": "_fabtypes.Shape", "uid": 5 } ], "inspector": [ 500.93246796419362, 69.219759209597669 ], "name": "r1", "script": [ "import fab", "import math", "", "title('Rotate (Z)')", "", "input('x', float)", "input('y', float)", "input('_z', float)", "input('a', float)", "", "input('shape', fab.types.Shape)", "output('rotated', fab.shapes.rotate_z(shape, a, x, y))", "", "# UI", "rad = math.radians(a)", "sb.ui.wireframe([(x + math.cos(rad), y + math.sin(rad), _z),", " (x, y, _z),", " (x + 1, y, _z)], color=sb.color.teal)", "", "# Draw a semi-circular arc showing the rotation", "if int(a) % 360 != 0:", " sb.ui.wireframe([", " (x + math.cos(math.radians(a_)) * 0.3,", " y + math.sin(math.radians(a_)) * 0.3, _z)", " for a_ in range(int(a) % 360)], color=sb.color.teal)", "", "sb.ui.point(x, y, _z, color=sb.color.teal)", "", "def drag_pt(this, x, y, z):", " this.a = math.degrees(math.atan2(y - this.y, x - this.x))", "sb.ui.point(x + math.cos(rad), y + math.sin(rad), _z,", " color=sb.color.teal, drag=drag_pt, relative=False)", "", "" ], "uid": 7 }, { "datums": [ { "expr": "\u0011[__6.__6]", "name": "shape", "type": "_fabtypes.Shape", "uid": 0 }, { "expr": "\u0012fab.types.Shape('m+f0/-Xf0f2+f0/-Yf0f0.5_m-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107Y+*f-0.707107X*f0.707107Y_m-Xf-0-Yf-0-Zf0m+f0/*-Xf0f1+*f0-Zf0*f1-f1Z+f0/*-Yf0f1+*f0-Zf0*f1-f1Z_am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f0Z-Zf1',float('-2.828428'),float('-0.707107'),float('0.000000'),float('2.828428'),float('0.707107'),float('1.000000'))", "name": "copy", "type": "_fabtypes.Shape", "uid": 1 } ], "inspector": [ 817.88610223971978, -138.43951841919537 ], "name": "c0", "script": [ "# Neil Gershenfeld 2/14/15", "# Matt Keeter 6/12/15", "", "import fab", "", "title('Copy')", "", "input('shape', fab.types.Shape)", "output('copy', shape)", "", "" ], "uid": 8 }, { "datums": [ { "expr": "0.0", "name": "_x", "type": "float", "uid": 0 }, { "expr": "0.0", "name": "_y", "type": "float", "uid": 1 }, { "expr": "0.0", "name": "z0", "type": "float", "uid": 2 }, { "expr": "\u0011[__8.__0]", "name": "shape", "type": "_fabtypes.Shape", "uid": 3 }, { "expr": "\u0012fab.types.Shape('m__-*f2f0Zm+f0/-Xf0f2+f0/-Yf0f0.5_m-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107Y+*f-0.707107X*f0.707107Y_m-Xf-0-Yf-0-Zf0m+f0/*-Xf0f1+*f0-Zf0*f1-f1Z+f0/*-Yf0f1+*f0-Zf0*f1-f1Z_am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f0Z-Zf1',float('-2.828428'),float('-0.707107'),float('-1.000000'),float('2.828428'),float('0.707107'),float('0.000000'))", "name": "reflected", "type": "_fabtypes.Shape", "uid": 4 } ], "inspector": [ 799.67037613193111, 83.792340095828791 ], "name": "r2", "script": [ "import fab", "", "title('Reflect (Z)')", "", "input('_x', float)", "input('_y', float)", "input('z0', float)", "", "input('shape', fab.types.Shape)", "output('reflected', fab.shapes.reflect_z(shape, z0))", "", "# UI", "sb.ui.wireframe([", " (_x + 1, _y - 1, z0),", " (_x + 1, _y + 1, z0),", " (_x - 1, _y + 1, z0),", " (_x - 1, _y - 1, z0)], color=sb.color.teal, close=True)", "", "sb.ui.point(_x, _y, z0, color=sb.color.teal)", "" ], "uid": 9 }, { "datums": [ { "expr": "0", "name": "x0", "type": "float", "uid": 0 }, { "expr": "0", "name": "y0", "type": "float", "uid": 1 }, { "expr": "0.55", "name": "z0", "type": "float", "uid": 2 }, { "expr": "0.4", "name": "sx", "type": "float", "uid": 3 }, { "expr": "0.5", "name": "sy", "type": "float", "uid": 4 }, { "expr": "1.6", "name": "sz", "type": "float", "uid": 5 }, { "expr": "\u0011[__9.__4]", "name": "shape", "type": "_fabtypes.Shape", "uid": 6 }, { "expr": "\u0012fab.types.Shape('m+f0/-Xf0f0.4+f0/-Yf0f0.5+f0.55/-Zf0.55f1.6m__-*f2f0Zm+f0/-Xf0f2+f0/-Yf0f0.5_m-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107Y+*f-0.707107X*f0.707107Y_m-Xf-0-Yf-0-Zf0m+f0/*-Xf0f1+*f0-Zf0*f1-f1Z+f0/*-Yf0f1+*f0-Zf0*f1-f1Z_am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f0Z-Zf1',float('-1.131371'),float('-0.353554'),float('-1.930000'),float('1.131371'),float('0.353554'),float('-0.330000'))", "name": "scaled", "type": "_fabtypes.Shape", "uid": 7 } ], "inspector": [ 812.42138440738324, 231.33972156891843 ], "name": "s4", "script": [ "# Neil Gershenfeld 1/24/15", "# Matt Keeter 5/13/15", "", "import fab", "", "title('Scale (3D)')", "", "input('x0', float)", "input('y0', float)", "input('z0', float)", "input('sx', float)", "input('sy', float)", "input('sz', float)", "", "input('shape', fab.types.Shape)", "output('scaled', fab.shapes.scale_xyz(", " shape, x0, y0, z0, sx, sy, sz))", "", "# UI", "sb.ui.wireframe([(x0 + sx, y0, z0), (x0, y0, z0), (x0, y0 + sy, z0)],", " color=sb.color.teal)", "sb.ui.wireframe([(x0, y0, z0), (x0, y0, z0 + sz)],", " color=sb.color.teal)", "sb.ui.wireframe([(x0 + sx, y0 + sx/10, z0), (x0 + sx, y0 - sx/10, z0)],", " color=sb.color.teal)", "sb.ui.wireframe([(x0 + sy/10, y0 + sy, z0), (x0 - sy/10, y0 + sy, z0)],", " color=sb.color.teal)", "sb.ui.wireframe([(x0 + sz/10, y0, z0 + sz), (x0 - sz/10, y0, z0 + sz)],", " color=sb.color.teal)", "", "sb.ui.point(x0, y0, z0, color=sb.color.teal)", "sb.ui.point(x0 + sx, y0, z0, color=sb.color.teal, drag=(sx, None, None))", "sb.ui.point(x0, y0 + sy, z0, color=sb.color.teal, drag=(None, sy, None))", "sb.ui.point(x0, y0, z0 + sz, color=sb.color.teal, drag=(None, None, sz))", "" ], "uid": 10 }, { "datums": [ { "expr": "0.0", "name": "_x", "type": "float", "uid": 0 }, { "expr": "0.0", "name": "_y", "type": "float", "uid": 1 }, { "expr": "0.0", "name": "_z", "type": "float", "uid": 2 }, { "expr": "0", "name": "dx", "type": "float", "uid": 3 }, { "expr": "0.0", "name": "dy", "type": "float", "uid": 4 }, { "expr": "0.6", "name": "dz", "type": "float", "uid": 5 }, { "expr": "\u0011[__10.__7]", "name": "shape", "type": "_fabtypes.Shape", "uid": 6 }, { "expr": "\u0012fab.types.Shape('m-Xf0-Yf0-Zf0.6m+f0/-Xf0f0.4+f0/-Yf0f0.5+f0.55/-Zf0.55f1.6m__-*f2f0Zm+f0/-Xf0f2+f0/-Yf0f0.5_m-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107Y+*f-0.707107X*f0.707107Y_m-Xf-0-Yf-0-Zf0m+f0/*-Xf0f1+*f0-Zf0*f1-f1Z+f0/*-Yf0f1+*f0-Zf0*f1-f1Z_am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f0Z-Zf1',float('-1.131371'),float('-0.353554'),float('-1.330000'),float('1.131371'),float('0.353554'),float('0.270000'))", "name": "out", "type": "_fabtypes.Shape", "uid": 7 } ], "inspector": [ 808.77823918582567, 522.79133929354043 ], "name": "t0", "script": [ "import fab", "", "title('Translate')", "", "input('_x', float)", "input('_y', float)", "input('_z', float)", "input('dx', float)", "input('dy', float)", "input('dz', float)", "", "input('shape', fab.types.Shape)", "output('out', fab.shapes.translate(shape, dx, dy, dz))", "", "# UI", "sb.ui.wireframe([(_x, _y, _z),", " (_x + dx, _y + dy, _z + dz)], color=sb.color.teal)", "sb.ui.wireframe([(_x, _y - 0.3, _z),", " (_x, _y + 0.3, _z)], color=sb.color.teal)", "sb.ui.wireframe([(_x - 0.3, _y, _z),", " (_x + 0.3, _y, _z)], color=sb.color.teal)", "sb.ui.wireframe([(_x, _y, _z - 0.3),", " (_x, _y, _z + 0.3)], color=sb.color.teal)", "", "sb.ui.point(_x, _y, _z, color=sb.color.teal)", "sb.ui.point(_x + dx, _y + dy, _z + dz, color=sb.color.teal, drag=(dx, dy, dz))", "" ], "uid": 11 }, { "datums": [ { "expr": "0", "name": "x", "type": "float", "uid": 0 }, { "expr": "0", "name": "y", "type": "float", "uid": 1 }, { "expr": "1.19", "name": "z", "type": "float", "uid": 2 }, { "expr": "4", "name": "width", "type": "float", "uid": 3 }, { "expr": "2", "name": "height", "type": "float", "uid": 4 }, { "expr": "1", "name": "depth", "type": "float", "uid": 5 }, { "expr": "\u0012fab.types.Shape('am__f1aa-f-2X-Xf2a-f-1Y-Yf1a-f0.69Z-Zf1.69',float('-2.000000'),float('-1.000000'),float('0.690000'),float('2.000000'),float('1.000000'),float('1.690000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 6 } ], "inspector": [ 1131.1965912936882, -29.145161772462174 ], "name": "c1", "script": [ "# Neil Gershenfeld 1/24/15", "# Matt Keeter 5/22/15", "", "import fab", "", "title('Cube (center)')", "", "input('x', float)", "input('y', float)", "input('z', float)", "input('width', float)", "input('height', float)", "input('depth', float)", "", "xmin, xmax = x - width/2, x + width/2", "ymin, ymax = y - height/2, y + height/2", "zmin, zmax = z - depth/2, z + depth/2", "", "output('shape', fab.shapes.cube(xmin, xmax, ymin, ymax, zmin, zmax))", "", "# UI", "sb.ui.wireframe([(xmin, ymin, zmin), (xmax, ymin, zmin),", " (xmax, ymax, zmin), (xmin, ymax, zmin)], close=True)", "sb.ui.wireframe([(xmin, ymin, zmax), (xmax, ymin, zmax),", " (xmax, ymax, zmax), (xmin, ymax, zmax)], close=True)", "sb.ui.wireframe([(xmin, ymin, zmin), (xmin, ymax, zmin),", " (xmin, ymax, zmax), (xmin, ymin, zmax)], close=True)", "sb.ui.wireframe([(xmax, ymin, zmin), (xmax, ymax, zmin),", " (xmax, ymax, zmax), (xmax, ymin, zmax)], close=True)", "", "def drag_hwd(this, dx,dy,dz):", " this.width += 2*dx", " this.height += 2*dy", " this.depth += 2*dz", "", "sb.ui.point(x, y, z)", "sb.ui.point(x + width/2.0, y + height/2.0, z + depth/2.0,", " drag=drag_hwd)", "", "" ], "uid": 13 }, { "datums": [ { "expr": "\u0011[__8.__1]", "name": "a", "type": "_fabtypes.Shape", "uid": 0 }, { "expr": "\u0011[__13.__6]", "name": "b", "type": "_fabtypes.Shape", "uid": 1 }, { "expr": "\u0012fab.types.Shape('am+f0/-Xf0f2+f0/-Yf0f0.5_m-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107Y+*f-0.707107X*f0.707107Y_m-Xf-0-Yf-0-Zf0m+f0/*-Xf0f1+*f0-Zf0*f1-f1Z+f0/*-Yf0f1+*f0-Zf0*f1-f1Z_am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f0Z-Zf1nam__f1aa-f-2X-Xf2a-f-1Y-Yf1a-f0.69Z-Zf1.69',float('-2.828428'),float('-0.707107'),float('0.000000'),float('2.828428'),float('0.707107'),float('1.000000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 2 } ], "inspector": [ 1133.0181639044672, 236.80443940125519 ], "name": "d1", "script": [ "import fab.types", "", "title('Difference')", "input('a', fab.types.Shape)", "input('b', fab.types.Shape)", "", "output('shape', a & ~b)", "" ], "uid": 14 }, { "datums": [ { "expr": "\u0011[__14.__2]", "name": "shape", "type": "_fabtypes.Shape", "uid": 0 }, { "expr": "\u0012fab.types.Shape('am+f0/-Xf0f2+f0/-Yf0f0.5_m-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107Y+*f-0.707107X*f0.707107Y_m-Xf-0-Yf-0-Zf0m+f0/*-Xf0f1+*f0-Zf0*f1-f1Z+f0/*-Yf0f1+*f0-Zf0*f1-f1Z_am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f0Z-Zf1nam__f1aa-f-2X-Xf2a-f-1Y-Yf1a-f0.69Z-Zf1.69',float('-2.828428'),float('-0.707107'),float('0.000000'),float('2.828428'),float('0.707107'),float('1.000000'))", "name": "copy", "type": "_fabtypes.Shape", "uid": 1 } ], "inspector": [ 1424.4697816290882, -20.037298718567737 ], "name": "c2", "script": [ "# Neil Gershenfeld 2/14/15", "# Matt Keeter 6/12/15", "", "import fab", "", "title('Copy')", "", "input('shape', fab.types.Shape)", "output('copy', shape)", "", "" ], "uid": 15 }, { "datums": [ { "expr": "0.0", "name": "_x", "type": "float", "uid": 0 }, { "expr": "0.0", "name": "_y", "type": "float", "uid": 1 }, { "expr": "0.0", "name": "_z", "type": "float", "uid": 2 }, { "expr": "0", "name": "dx", "type": "float", "uid": 3 }, { "expr": "0", "name": "dy", "type": "float", "uid": 4 }, { "expr": "-0.3", "name": "dz", "type": "float", "uid": 5 }, { "expr": "\u0011[__15.__0]", "name": "shape", "type": "_fabtypes.Shape", "uid": 6 }, { "expr": "\u0012fab.types.Shape('m-Xf0-Yf0-Zf-0.3am+f0/-Xf0f2+f0/-Yf0f0.5_m-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107Y+*f-0.707107X*f0.707107Y_m-Xf-0-Yf-0-Zf0m+f0/*-Xf0f1+*f0-Zf0*f1-f1Z+f0/*-Yf0f1+*f0-Zf0*f1-f1Z_am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f0Z-Zf1nam__f1aa-f-2X-Xf2a-f-1Y-Yf1a-f0.69Z-Zf1.69',float('-2.828428'),float('-0.707107'),float('-0.300000'),float('2.828428'),float('0.707107'),float('0.700000'))", "name": "out", "type": "_fabtypes.Shape", "uid": 7 } ], "inspector": [ 1428.1129268506461, 105.65121142517535 ], "name": "t1", "script": [ "import fab", "", "title('Translate')", "", "input('_x', float)", "input('_y', float)", "input('_z', float)", "input('dx', float)", "input('dy', float)", "input('dz', float)", "", "input('shape', fab.types.Shape)", "output('out', fab.shapes.translate(shape, dx, dy, dz))", "", "# UI", "sb.ui.wireframe([(_x, _y, _z),", " (_x + dx, _y + dy, _z + dz)], color=sb.color.teal)", "sb.ui.wireframe([(_x, _y - 0.3, _z),", " (_x, _y + 0.3, _z)], color=sb.color.teal)", "sb.ui.wireframe([(_x - 0.3, _y, _z),", " (_x + 0.3, _y, _z)], color=sb.color.teal)", "sb.ui.wireframe([(_x, _y, _z - 0.3),", " (_x, _y, _z + 0.3)], color=sb.color.teal)", "", "sb.ui.point(_x, _y, _z, color=sb.color.teal)", "sb.ui.point(_x + dx, _y + dy, _z + dz, color=sb.color.teal, drag=(dx, dy, dz))", "" ], "uid": 16 }, { "datums": [ { "expr": "\u0011[__15.__1]", "name": "a", "type": "_fabtypes.Shape", "uid": 0 }, { "expr": "\u0011[__16.__7]", "name": "b", "type": "_fabtypes.Shape", "uid": 1 }, { "expr": "\u0012fab.types.Shape('aam+f0/-Xf0f2+f0/-Yf0f0.5_m-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107Y+*f-0.707107X*f0.707107Y_m-Xf-0-Yf-0-Zf0m+f0/*-Xf0f1+*f0-Zf0*f1-f1Z+f0/*-Yf0f1+*f0-Zf0*f1-f1Z_am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f0Z-Zf1nam__f1aa-f-2X-Xf2a-f-1Y-Yf1a-f0.69Z-Zf1.69nm-Xf0-Yf0-Zf-0.3am+f0/-Xf0f2+f0/-Yf0f0.5_m-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107Y+*f-0.707107X*f0.707107Y_m-Xf-0-Yf-0-Zf0m+f0/*-Xf0f1+*f0-Zf0*f1-f1Z+f0/*-Yf0f1+*f0-Zf0*f1-f1Z_am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f0Z-Zf1nam__f1aa-f-2X-Xf2a-f-1Y-Yf1a-f0.69Z-Zf1.69',float('-2.828428'),float('-0.707107'),float('0.000000'),float('2.828428'),float('0.707107'),float('1.000000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 2 } ], "inspector": [ 1420.8266364075303, 387.99496609590261 ], "name": "d2", "script": [ "import fab.types", "", "title('Difference')", "input('a', fab.types.Shape)", "input('b', fab.types.Shape)", "", "output('shape', a & ~b)", "" ], "uid": 17 }, { "datums": [ { "expr": "0.0", "name": "_x", "type": "float", "uid": 0 }, { "expr": "0.0", "name": "_y", "type": "float", "uid": 1 }, { "expr": "0.0", "name": "z0", "type": "float", "uid": 2 }, { "expr": "\u0011[__17.__2,__11.__7]", "name": "shape", "type": "_fabtypes.Shape", "uid": 3 }, { "expr": "\u0012fab.types.Shape('m__-*f2f0Ziaam+f0/-Xf0f2+f0/-Yf0f0.5_m-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107Y+*f-0.707107X*f0.707107Y_m-Xf-0-Yf-0-Zf0m+f0/*-Xf0f1+*f0-Zf0*f1-f1Z+f0/*-Yf0f1+*f0-Zf0*f1-f1Z_am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f0Z-Zf1nam__f1aa-f-2X-Xf2a-f-1Y-Yf1a-f0.69Z-Zf1.69nm-Xf0-Yf0-Zf-0.3am+f0/-Xf0f2+f0/-Yf0f0.5_m-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107Y+*f-0.707107X*f0.707107Y_m-Xf-0-Yf-0-Zf0m+f0/*-Xf0f1+*f0-Zf0*f1-f1Z+f0/*-Yf0f1+*f0-Zf0*f1-f1Z_am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f0Z-Zf1nam__f1aa-f-2X-Xf2a-f-1Y-Yf1a-f0.69Z-Zf1.69m-Xf0-Yf0-Zf0.6m+f0/-Xf0f0.4+f0/-Yf0f0.5+f0.55/-Zf0.55f1.6m__-*f2f0Zm+f0/-Xf0f2+f0/-Yf0f0.5_m-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107Y+*f-0.707107X*f0.707107Y_m-Xf-0-Yf-0-Zf0m+f0/*-Xf0f1+*f0-Zf0*f1-f1Z+f0/*-Yf0f1+*f0-Zf0*f1-f1Z_am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f0Z-Zf1',float('-2.828428'),float('-0.707107'),float('-1.000000'),float('2.828428'),float('0.707107'),float('1.330000'))", "name": "reflected", "type": "_fabtypes.Shape", "uid": 4 } ], "inspector": [ 1786.9627311740865, -29.145161772462163 ], "name": "r3", "script": [ "import fab", "", "title('Reflect (Z)')", "", "input('_x', float)", "input('_y', float)", "input('z0', float)", "", "input('shape', fab.types.Shape)", "output('reflected', fab.shapes.reflect_z(shape, z0))", "", "# UI", "sb.ui.wireframe([", " (_x + 1, _y - 1, z0),", " (_x + 1, _y + 1, z0),", " (_x - 1, _y + 1, z0),", " (_x - 1, _y - 1, z0)], color=sb.color.teal, close=True)", "", "sb.ui.point(_x, _y, z0, color=sb.color.teal)", "" ], "uid": 18 }, { "datums": [ { "expr": "0", "name": "x0", "type": "float", "uid": 0 }, { "expr": "0", "name": "y0", "type": "float", "uid": 1 }, { "expr": "0", "name": "z0", "type": "float", "uid": 2 }, { "expr": "0.25", "name": "sx", "type": "float", "uid": 3 }, { "expr": "0.30", "name": "sy", "type": "float", "uid": 4 }, { "expr": "0.30", "name": "sz", "type": "float", "uid": 5 }, { "expr": "\u0011[__18.__4]", "name": "shape", "type": "_fabtypes.Shape", "uid": 6 }, { "expr": "\u0012fab.types.Shape('m+f0/-Xf0f0.25+f0/-Yf0f0.3+f0/-Zf0f0.3m__-*f2f0Ziaam+f0/-Xf0f2+f0/-Yf0f0.5_m-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107Y+*f-0.707107X*f0.707107Y_m-Xf-0-Yf-0-Zf0m+f0/*-Xf0f1+*f0-Zf0*f1-f1Z+f0/*-Yf0f1+*f0-Zf0*f1-f1Z_am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f0Z-Zf1nam__f1aa-f-2X-Xf2a-f-1Y-Yf1a-f0.69Z-Zf1.69nm-Xf0-Yf0-Zf-0.3am+f0/-Xf0f2+f0/-Yf0f0.5_m-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107Y+*f-0.707107X*f0.707107Y_m-Xf-0-Yf-0-Zf0m+f0/*-Xf0f1+*f0-Zf0*f1-f1Z+f0/*-Yf0f1+*f0-Zf0*f1-f1Z_am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f0Z-Zf1nam__f1aa-f-2X-Xf2a-f-1Y-Yf1a-f0.69Z-Zf1.69m-Xf0-Yf0-Zf0.6m+f0/-Xf0f0.4+f0/-Yf0f0.5+f0.55/-Zf0.55f1.6m__-*f2f0Zm+f0/-Xf0f2+f0/-Yf0f0.5_m-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107Y+*f-0.707107X*f0.707107Y_m-Xf-0-Yf-0-Zf0m+f0/*-Xf0f1+*f0-Zf0*f1-f1Z+f0/*-Yf0f1+*f0-Zf0*f1-f1Z_am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f0Z-Zf1',float('-0.707107'),float('-0.212132'),float('-0.300000'),float('0.707107'),float('0.212132'),float('0.399000'))", "name": "scaled", "type": "_fabtypes.Shape", "uid": 7 } ], "inspector": [ 1795.0280894519199, 138.94906903048164 ], "name": "s5", "script": [ "# Neil Gershenfeld 1/24/15", "# Matt Keeter 5/13/15", "", "import fab", "", "title('Scale (3D)')", "", "input('x0', float)", "input('y0', float)", "input('z0', float)", "input('sx', float)", "input('sy', float)", "input('sz', float)", "", "input('shape', fab.types.Shape)", "output('scaled', fab.shapes.scale_xyz(", " shape, x0, y0, z0, sx, sy, sz))", "", "# UI", "sb.ui.wireframe([(x0 + sx, y0, z0), (x0, y0, z0), (x0, y0 + sy, z0)],", " color=sb.color.teal)", "sb.ui.wireframe([(x0, y0, z0), (x0, y0, z0 + sz)],", " color=sb.color.teal)", "sb.ui.wireframe([(x0 + sx, y0 + sx/10, z0), (x0 + sx, y0 - sx/10, z0)],", " color=sb.color.teal)", "sb.ui.wireframe([(x0 + sy/10, y0 + sy, z0), (x0 - sy/10, y0 + sy, z0)],", " color=sb.color.teal)", "sb.ui.wireframe([(x0 + sz/10, y0, z0 + sz), (x0 - sz/10, y0, z0 + sz)],", " color=sb.color.teal)", "", "sb.ui.point(x0, y0, z0, color=sb.color.teal)", "sb.ui.point(x0 + sx, y0, z0, color=sb.color.teal, drag=(sx, None, None))", "sb.ui.point(x0, y0 + sy, z0, color=sb.color.teal, drag=(None, sy, None))", "sb.ui.point(x0, y0, z0 + sz, color=sb.color.teal, drag=(None, None, sz))", "" ], "uid": 19 }, { "datums": [ { "expr": "0.0", "name": "x", "type": "float", "uid": 0 }, { "expr": "0.0", "name": "_y", "type": "float", "uid": 1 }, { "expr": "0.0", "name": "z", "type": "float", "uid": 2 }, { "expr": "7", "name": "a", "type": "float", "uid": 3 }, { "expr": "\u0011[__19.__7]", "name": "shape", "type": "_fabtypes.Shape", "uid": 4 }, { "expr": "\u0012fab.types.Shape('m-Xf0-Yf0-Zf0m+*f0.992546X*f0.121869ZY+*f-0.121869X*f0.992546Zm-Xf-0-Yf0-Zf-0m+f0/-Xf0f0.25+f0/-Yf0f0.3+f0/-Zf0f0.3m__-*f2f0Ziaam+f0/-Xf0f2+f0/-Yf0f0.5_m-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107Y+*f-0.707107X*f0.707107Y_m-Xf-0-Yf-0-Zf0m+f0/*-Xf0f1+*f0-Zf0*f1-f1Z+f0/*-Yf0f1+*f0-Zf0*f1-f1Z_am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f0Z-Zf1nam__f1aa-f-2X-Xf2a-f-1Y-Yf1a-f0.69Z-Zf1.69nm-Xf0-Yf0-Zf-0.3am+f0/-Xf0f2+f0/-Yf0f0.5_m-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107Y+*f-0.707107X*f0.707107Y_m-Xf-0-Yf-0-Zf0m+f0/*-Xf0f1+*f0-Zf0*f1-f1Z+f0/*-Yf0f1+*f0-Zf0*f1-f1Z_am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f0Z-Zf1nam__f1aa-f-2X-Xf2a-f-1Y-Yf1a-f0.69Z-Zf1.69m-Xf0-Yf0-Zf0.6m+f0/-Xf0f0.4+f0/-Yf0f0.5+f0.55/-Zf0.55f1.6m__-*f2f0Zm+f0/-Xf0f2+f0/-Yf0f0.5_m-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107Y+*f-0.707107X*f0.707107Y_m-Xf-0-Yf-0-Zf0m+f0/*-Xf0f1+*f0-Zf0*f1-f1Z+f0/*-Yf0f1+*f0-Zf0*f1-f1Z_am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f0Z-Zf1',float('-0.750462'),float('-0.212132'),float('-0.383938'),float('0.738397'),float('0.212132'),float('0.482200'))", "name": "rotated", "type": "_fabtypes.Shape", "uid": 5 } ], "inspector": [ 1798.259463150303, 426.5413281865948 ], "name": "r4", "script": [ "import fab", "import math", "", "title('Rotate (Y)')", "", "input('x', float)", "input('_y', float)", "input('z', float)", "input('a', float)", "", "input('shape', fab.types.Shape)", "output('rotated', fab.shapes.rotate_y(shape, a, x, z))", "", "# UI", "rad = math.radians(a)", "sb.ui.wireframe([(x + math.cos(rad), _y, z + math.sin(rad)),", " (x, _y, z),", " (x + 1, _y, z)], color=sb.color.teal)", "", "# Draw a semi-circular arc showing the rotation", "if int(a) % 360 != 0:", " sb.ui.wireframe([", " (x + math.cos(math.radians(a_)) * 0.3, _y,", " z + math.sin(math.radians(a_)) * 0.3)", " for a_ in range(int(a) % 360)], color=sb.color.teal)", "", "sb.ui.point(x, _y, z, color=sb.color.teal)", "", "def drag_pt(this, x, y, z):", " this.a = math.degrees(math.atan2(z - this.z, x - this.x))", "sb.ui.point(x + math.cos(rad), _y, z + math.sin(rad),", " color=sb.color.teal, drag=drag_pt, relative=False)", "", "" ], "uid": 20 }, { "datums": [ { "expr": "0.0", "name": "_x", "type": "float", "uid": 0 }, { "expr": "0.0", "name": "y", "type": "float", "uid": 1 }, { "expr": "0.0", "name": "z", "type": "float", "uid": 2 }, { "expr": "8", "name": "a", "type": "float", "uid": 3 }, { "expr": "\u0011[__20.__5]", "name": "shape", "type": "_fabtypes.Shape", "uid": 4 }, { "expr": "\u0012fab.types.Shape('m-Xf0-Yf0-Zf0m_+*f0.990268Y*f0.139173Z+*f-0.139173Y*f0.990268Zm-Xf0-Yf-0-Zf-0m-Xf0-Yf0-Zf0m+*f0.992546X*f0.121869ZY+*f-0.121869X*f0.992546Zm-Xf-0-Yf0-Zf-0m+f0/-Xf0f0.25+f0/-Yf0f0.3+f0/-Zf0f0.3m__-*f2f0Ziaam+f0/-Xf0f2+f0/-Yf0f0.5_m-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107Y+*f-0.707107X*f0.707107Y_m-Xf-0-Yf-0-Zf0m+f0/*-Xf0f1+*f0-Zf0*f1-f1Z+f0/*-Yf0f1+*f0-Zf0*f1-f1Z_am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f0Z-Zf1nam__f1aa-f-2X-Xf2a-f-1Y-Yf1a-f0.69Z-Zf1.69nm-Xf0-Yf0-Zf-0.3am+f0/-Xf0f2+f0/-Yf0f0.5_m-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107Y+*f-0.707107X*f0.707107Y_m-Xf-0-Yf-0-Zf0m+f0/*-Xf0f1+*f0-Zf0*f1-f1Z+f0/*-Yf0f1+*f0-Zf0*f1-f1Z_am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f0Z-Zf1nam__f1aa-f-2X-Xf2a-f-1Y-Yf1a-f0.69Z-Zf1.69m-Xf0-Yf0-Zf0.6m+f0/-Xf0f0.4+f0/-Yf0f0.5+f0.55/-Zf0.55f1.6m__-*f2f0Zm+f0/-Xf0f2+f0/-Yf0f0.5_m-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107Y+*f-0.707107X*f0.707107Y_m-Xf-0-Yf-0-Zf0m+f0/*-Xf0f1+*f0-Zf0*f1-f1Z+f0/*-Yf0f1+*f0-Zf0*f1-f1Z_am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f0Z-Zf1',float('-0.750462'),float('-0.277177'),float('-0.409725'),float('0.738397'),float('0.263501'),float('0.507030'))", "name": "rotated", "type": "_fabtypes.Shape", "uid": 5 } ], "inspector": [ 1796.3554935148109, 633.5642321612363 ], "name": "r5", "script": [ "import fab", "import math", "", "title('Rotate (X)')", "", "input('_x', float)", "input('y', float)", "input('z', float)", "input('a', float)", "", "input('shape', fab.types.Shape)", "output('rotated', fab.shapes.rotate_x(shape, a, y, z))", "", "# UI", "rad = math.radians(a)", "sb.ui.wireframe([(_x, y + math.cos(rad), z + math.sin(rad)),", " (_x, y, z),", " (_x, y + 1, z)], color=sb.color.teal)", "", "# Draw a semi-circular arc showing the rotation", "if int(a) % 360 != 0:", " sb.ui.wireframe([", " (_x, y + math.cos(math.radians(a_)) * 0.3,", " z + math.sin(math.radians(a_)) * 0.3)", " for a_ in range(int(a) % 360)], color=sb.color.teal)", "", "sb.ui.point(_x, y, z, color=sb.color.teal)", "", "def drag_pt(this, x, y, z):", " this.a = math.degrees(math.atan2(z - this.z, y - this.y))", "sb.ui.point(_x, y + math.cos(rad), z + math.sin(rad),", " color=sb.color.teal, drag=drag_pt, relative=False)", "", "" ], "uid": 21 }, { "datums": [ { "expr": "0.0", "name": "x", "type": "float", "uid": 0 }, { "expr": "0.0", "name": "y", "type": "float", "uid": 1 }, { "expr": "0.0", "name": "_z", "type": "float", "uid": 2 }, { "expr": "5", "name": "a", "type": "float", "uid": 3 }, { "expr": "\u0011[__21.__5]", "name": "shape", "type": "_fabtypes.Shape", "uid": 4 }, { "expr": "\u0012fab.types.Shape('m-Xf0-Yf0-Zf0m+*f0.996195X*f0.0871557Y+*f-0.0871557X*f0.996195Y_m-Xf-0-Yf-0-Zf0m-Xf0-Yf0-Zf0m_+*f0.990268Y*f0.139173Z+*f-0.139173Y*f0.990268Zm-Xf0-Yf-0-Zf-0m-Xf0-Yf0-Zf0m+*f0.992546X*f0.121869ZY+*f-0.121869X*f0.992546Zm-Xf-0-Yf0-Zf-0m+f0/-Xf0f0.25+f0/-Yf0f0.3+f0/-Zf0f0.3m__-*f2f0Ziaam+f0/-Xf0f2+f0/-Yf0f0.5_m-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107Y+*f-0.707107X*f0.707107Y_m-Xf-0-Yf-0-Zf0m+f0/*-Xf0f1+*f0-Zf0*f1-f1Z+f0/*-Yf0f1+*f0-Zf0*f1-f1Z_am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f0Z-Zf1nam__f1aa-f-2X-Xf2a-f-1Y-Yf1a-f0.69Z-Zf1.69nm-Xf0-Yf0-Zf-0.3am+f0/-Xf0f2+f0/-Yf0f0.5_m-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107Y+*f-0.707107X*f0.707107Y_m-Xf-0-Yf-0-Zf0m+f0/*-Xf0f1+*f0-Zf0*f1-f1Z+f0/*-Yf0f1+*f0-Zf0*f1-f1Z_am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f0Z-Zf1nam__f1aa-f-2X-Xf2a-f-1Y-Yf1a-f0.69Z-Zf1.69m-Xf0-Yf0-Zf0.6m+f0/-Xf0f0.4+f0/-Yf0f0.5+f0.55/-Zf0.55f1.6m__-*f2f0Zm+f0/-Xf0f2+f0/-Yf0f0.5_m-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107Y+*f-0.707107X*f0.707107Y_m-Xf-0-Yf-0-Zf0m+f0/*-Xf0f1+*f0-Zf0*f1-f1Z+f0/*-Yf0f1+*f0-Zf0*f1-f1Z_am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f0Z-Zf1',float('-0.770572'),float('-0.341529'),float('-0.409725'),float('0.759745'),float('0.326854'),float('0.507030'))", "name": "rotated", "type": "_fabtypes.Shape", "uid": 5 } ], "inspector": [ 1789.3992745465489, 838.78090994369472 ], "name": "r6", "script": [ "import fab", "import math", "", "title('Rotate (Z)')", "", "input('x', float)", "input('y', float)", "input('_z', float)", "input('a', float)", "", "input('shape', fab.types.Shape)", "output('rotated', fab.shapes.rotate_z(shape, a, x, y))", "", "# UI", "rad = math.radians(a)", "sb.ui.wireframe([(x + math.cos(rad), y + math.sin(rad), _z),", " (x, y, _z),", " (x + 1, y, _z)], color=sb.color.teal)", "", "# Draw a semi-circular arc showing the rotation", "if int(a) % 360 != 0:", " sb.ui.wireframe([", " (x + math.cos(math.radians(a_)) * 0.3,", " y + math.sin(math.radians(a_)) * 0.3, _z)", " for a_ in range(int(a) % 360)], color=sb.color.teal)", "", "sb.ui.point(x, y, _z, color=sb.color.teal)", "", "def drag_pt(this, x, y, z):", " this.a = math.degrees(math.atan2(y - this.y, x - this.x))", "sb.ui.point(x + math.cos(rad), y + math.sin(rad), _z,", " color=sb.color.teal, drag=drag_pt, relative=False)", "", "" ], "uid": 22 }, { "datums": [ { "expr": "0", "name": "x0", "type": "float", "uid": 0 }, { "expr": "0", "name": "y0", "type": "float", "uid": 1 }, { "expr": "0.95", "name": "r", "type": "float", "uid": 2 }, { "expr": "0", "name": "_a", "type": "float", "uid": 3 }, { "expr": "\u0012fab.types.Shape('-r+qXqYf0.95',float('-0.950000'),float('-0.950000'),float('-inf'),float('0.950000'),float('0.950000'),float('inf'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 4 } ], "inspector": [ -154.02706802372816, 1067.9210049645146 ], "name": "c3", "script": [ "# Neil Gershenfeld 1/24/15", "# Matt Keeter 6/11/18", "", "import fab", "import math", "", "title('Circle (center)')", "", "input('x0',float)", "input('y0',float)", "input('r',float)", "input('_a',float)", "", "output('shape', fab.shapes.circle(x0, y0, r))", "", "def drag_r(this,x,y,z):", " dx = x - this.x0", " dy = y - this.y0", " this.r = math.sqrt(dx**2 + dy**2)", " this._a = math.atan2(dy, dx)", "", "# UI", "sb.ui.wireframe([", " (math.cos(i/36. * 2*math.pi) * r + x0,", " math.sin(i/36. * 2*math.pi) * r + y0, 0)", " for i in range(36)], close=True)", "sb.ui.point(x0,y0)", "sb.ui.point(x0 + r*math.cos(_a),", " y0 + r*math.sin(_a),", " drag=drag_r, relative=False)", "", "" ], "uid": 23 }, { "datums": [ { "expr": "0.0", "name": "x", "type": "float", "uid": 0 }, { "expr": "0", "name": "y", "type": "float", "uid": 1 }, { "expr": "0.22", "name": "z", "type": "float", "uid": 2 }, { "expr": "\u0011[__22.__5]", "name": "shape", "type": "_fabtypes.Shape", "uid": 3 }, { "expr": "\u0012fab.types.Shape('m-Xf0.0054135-Yf0.00733751-Zf0.171348m-Xf0-Yf0-Zf0m+*f0.996195X*f0.0871557Y+*f-0.0871557X*f0.996195Y_m-Xf-0-Yf-0-Zf0m-Xf0-Yf0-Zf0m_+*f0.990268Y*f0.139173Z+*f-0.139173Y*f0.990268Zm-Xf0-Yf-0-Zf-0m-Xf0-Yf0-Zf0m+*f0.992546X*f0.121869ZY+*f-0.121869X*f0.992546Zm-Xf-0-Yf0-Zf-0m+f0/-Xf0f0.25+f0/-Yf0f0.3+f0/-Zf0f0.3m__-*f2f0Ziaam+f0/-Xf0f2+f0/-Yf0f0.5_m-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107Y+*f-0.707107X*f0.707107Y_m-Xf-0-Yf-0-Zf0m+f0/*-Xf0f1+*f0-Zf0*f1-f1Z+f0/*-Yf0f1+*f0-Zf0*f1-f1Z_am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f0Z-Zf1nam__f1aa-f-2X-Xf2a-f-1Y-Yf1a-f0.69Z-Zf1.69nm-Xf0-Yf0-Zf-0.3am+f0/-Xf0f2+f0/-Yf0f0.5_m-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107Y+*f-0.707107X*f0.707107Y_m-Xf-0-Yf-0-Zf0m+f0/*-Xf0f1+*f0-Zf0*f1-f1Z+f0/*-Yf0f1+*f0-Zf0*f1-f1Z_am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f0Z-Zf1nam__f1aa-f-2X-Xf2a-f-1Y-Yf1a-f0.69Z-Zf1.69m-Xf0-Yf0-Zf0.6m+f0/-Xf0f0.4+f0/-Yf0f0.5+f0.55/-Zf0.55f1.6m__-*f2f0Zm+f0/-Xf0f2+f0/-Yf0f0.5_m-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107Y+*f-0.707107X*f0.707107Y_m-Xf-0-Yf-0-Zf0m+f0/*-Xf0f1+*f0-Zf0*f1-f1Z+f0/*-Yf0f1+*f0-Zf0*f1-f1Z_am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f0Z-Zf1',float('-0.765159'),float('-0.334192'),float('-0.238377'),float('0.765158'),float('0.334192'),float('0.678378'))", "name": "out", "type": "_fabtypes.Shape", "uid": 4 } ], "inspector": [ 1787.0535839534471, 1067.9210049645151 ], "name": "r7", "script": [ "import fab", "", "title('Recenter')", "", "input('x', float)", "input('y', float)", "input('z', float)", "", "input('shape', fab.types.Shape)", "output('out', fab.shapes.recenter(shape, x, y, z))", "", "# UI", "sb.ui.wireframe([(x, y - 0.3, z),", " (x, y + 0.3, z)], color=sb.color.teal)", "sb.ui.wireframe([(x - 0.3, y, z),", " (x + 0.3, y, z)], color=sb.color.teal)", "sb.ui.wireframe([(x, y, z - 0.3),", " (x, y, z + 0.3)], color=sb.color.teal)", "", "sb.ui.point(x, y, z, color=sb.color.teal)", "" ], "uid": 24 }, { "datums": [ { "expr": "0.0", "name": "_x", "type": "float", "uid": 0 }, { "expr": "0.0", "name": "_y", "type": "float", "uid": 1 }, { "expr": "0", "name": "zmin", "type": "float", "uid": 2 }, { "expr": "0.05", "name": "zmax", "type": "float", "uid": 3 }, { "expr": "\u0011[__23.__4]", "name": "shape", "type": "_fabtypes.Shape", "uid": 4 }, { "expr": "\u0012fab.types.Shape('am__f1-r+qXqYf0.95a-f0Z-Zf0.05',float('-0.950000'),float('-0.950000'),float('0.000000'),float('0.950000'),float('0.950000'),float('0.050000'))", "name": "out", "type": "_fabtypes.Shape", "uid": 5 } ], "inspector": [ -147.86598530277899, 1244.5387096317231 ], "name": "e0", "script": [ "import fab", "", "title('Extrude')", "", "input('_x', float)", "input('_y', float)", "input('zmin', float)", "input('zmax', float)", "", "input('shape', fab.types.Shape)", "output('out', fab.shapes.extrude_z(shape, zmin, zmax))", "", "# UI", "sb.ui.wireframe([(_x, _y, zmin), (_x, _y, zmax)], color=sb.color.green)", "sb.ui.point(_x, _y, zmin, color=sb.color.green)", "sb.ui.point(_x, _y, zmax, color=sb.color.green)", "", "" ], "uid": 25 }, { "datums": [ { "expr": "-1", "name": "xmin", "type": "float", "uid": 0 }, { "expr": "1", "name": "xmax", "type": "float", "uid": 1 }, { "expr": "-1", "name": "ymin", "type": "float", "uid": 2 }, { "expr": "1", "name": "ymax", "type": "float", "uid": 3 }, { "expr": "-1", "name": "zmin", "type": "float", "uid": 4 }, { "expr": "1", "name": "zmax", "type": "float", "uid": 5 }, { "expr": "100", "name": "x_period", "type": "float", "uid": 6 }, { "expr": "100", "name": "y_period", "type": "float", "uid": 7 }, { "expr": "100", "name": "z_period", "type": "float", "uid": 8 }, { "expr": "0.2", "name": "thickness", "type": "float", "uid": 9 }, { "expr": "\u0012fab.types.Shape('a= abs( sin(X / 0.06283185307179587)*cos(Y / 0.06283185307179587) + sin(Y / 0.06283185307179587)*cos(Z /0.06283185307179587) + sin(Z / 0.06283185307179587)*cos(X / 0.06283185307179587)) - 0.2;am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f-1Z-Zf1',float('-1.000000'),float('-1.000000'),float('-1.000000'),float('1.000000'),float('1.000000'),float('1.000000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 10 } ], "inspector": [ 156.6136617529711, 1067.9554403105003 ], "name": "g0", "script": [ "import fab", "import math", "", "#https://en.wikipedia.org/wiki/Gyroid", "title('Gyroid')", "", "input('xmin', float)", "input('xmax', float)", "input('ymin', float)", "input('ymax', float)", "input('zmin', float)", "input('zmax', float)", "", "input('x_period', float)", "input('y_period', float)", "input('z_period', float)", "input('thickness', float)", "", "x_factor = 2 * math.pi / x_period", "y_factor = 2 * math.pi / y_period", "z_factor = 2 * math.pi / z_period", "", "fn = \"= abs( sin(X / %(x_factor)s)*cos(Y / %(y_factor)s) + sin(Y / %(y_factor)s)*cos(Z /%(z_factor)s) + sin(Z / %(z_factor)s)*cos(X / %(x_factor)s)) - %(thickness)s;\" % locals()", "", "output('shape', fab.shapes.function_prefix_xyz(fn, xmin, xmax,", " ymin, ymax,", " zmin, zmax))", "" ], "uid": 26 }, { "datums": [ { "expr": "\u0011[__25.__5]", "name": "a", "type": "_fabtypes.Shape", "uid": 0 }, { "expr": "\u0011[__26.__10]", "name": "b", "type": "_fabtypes.Shape", "uid": 1 }, { "expr": "\u0012fab.types.Shape('aam__f1-r+qXqYf0.95a-f0Z-Zf0.05a= abs( sin(X / 0.06283185307179587)*cos(Y / 0.06283185307179587) + sin(Y / 0.06283185307179587)*cos(Z /0.06283185307179587) + sin(Z / 0.06283185307179587)*cos(X / 0.06283185307179587)) - 0.2;am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f-1Z-Zf1',float('-0.950000'),float('-0.950000'),float('0.000000'),float('0.950000'),float('0.950000'),float('0.050000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 2 } ], "inspector": [ 465.61519215377234, 1474.7418711929731 ], "name": "i1", "script": [ "import fab.types", "", "title('Intersection')", "input('a', fab.types.Shape)", "input('b', fab.types.Shape)", "", "output('shape', a & b)", "" ], "uid": 27 }, { "datums": [ { "expr": "\u0011[__25.__5]", "name": "shape", "type": "_fabtypes.Shape", "uid": 0 }, { "expr": "\u0012fab.types.Shape('am__f1-r+qXqYf0.95a-f0Z-Zf0.05',float('-0.950000'),float('-0.950000'),float('0.000000'),float('0.950000'),float('0.950000'),float('0.050000'))", "name": "copy", "type": "_fabtypes.Shape", "uid": 1 } ], "inspector": [ -161.93709196660237, 1587.8433442388978 ], "name": "c4", "script": [ "# Neil Gershenfeld 2/14/15", "# Matt Keeter 6/12/15", "", "import fab", "", "title('Copy')", "", "input('shape', fab.types.Shape)", "output('copy', shape)", "", "" ], "uid": 28 }, { "datums": [ { "expr": "0", "name": "x0", "type": "float", "uid": 0 }, { "expr": "0", "name": "y0", "type": "float", "uid": 1 }, { "expr": "0", "name": "z0", "type": "float", "uid": 2 }, { "expr": "0.95", "name": "sx", "type": "float", "uid": 3 }, { "expr": "0.95", "name": "sy", "type": "float", "uid": 4 }, { "expr": "1", "name": "sz", "type": "float", "uid": 5 }, { "expr": "\u0011[__28.__1]", "name": "shape", "type": "_fabtypes.Shape", "uid": 6 }, { "expr": "\u0012fab.types.Shape('m+f0/-Xf0f0.95+f0/-Yf0f0.95+f0/-Zf0f1am__f1-r+qXqYf0.95a-f0Z-Zf0.05',float('-0.902500'),float('-0.902500'),float('0.000000'),float('0.902500'),float('0.902500'),float('0.050000'))", "name": "scaled", "type": "_fabtypes.Shape", "uid": 7 } ], "inspector": [ -154.77173391498278, 1702.4890730648103 ], "name": "s6", "script": [ "# Neil Gershenfeld 1/24/15", "# Matt Keeter 5/13/15", "", "import fab", "", "title('Scale (3D)')", "", "input('x0', float)", "input('y0', float)", "input('z0', float)", "input('sx', float)", "input('sy', float)", "input('sz', float)", "", "input('shape', fab.types.Shape)", "output('scaled', fab.shapes.scale_xyz(", " shape, x0, y0, z0, sx, sy, sz))", "", "# UI", "sb.ui.wireframe([(x0 + sx, y0, z0), (x0, y0, z0), (x0, y0 + sy, z0)],", " color=sb.color.teal)", "sb.ui.wireframe([(x0, y0, z0), (x0, y0, z0 + sz)],", " color=sb.color.teal)", "sb.ui.wireframe([(x0 + sx, y0 + sx/10, z0), (x0 + sx, y0 - sx/10, z0)],", " color=sb.color.teal)", "sb.ui.wireframe([(x0 + sy/10, y0 + sy, z0), (x0 - sy/10, y0 + sy, z0)],", " color=sb.color.teal)", "sb.ui.wireframe([(x0 + sz/10, y0, z0 + sz), (x0 - sz/10, y0, z0 + sz)],", " color=sb.color.teal)", "", "sb.ui.point(x0, y0, z0, color=sb.color.teal)", "sb.ui.point(x0 + sx, y0, z0, color=sb.color.teal, drag=(sx, None, None))", "sb.ui.point(x0, y0 + sy, z0, color=sb.color.teal, drag=(None, sy, None))", "sb.ui.point(x0, y0, z0 + sz, color=sb.color.teal, drag=(None, None, sz))", "" ], "uid": 29 }, { "datums": [ { "expr": "\u0011[__28.__0]", "name": "a", "type": "_fabtypes.Shape", "uid": 0 }, { "expr": "\u0011[__29.__7]", "name": "b", "type": "_fabtypes.Shape", "uid": 1 }, { "expr": "\u0012fab.types.Shape('aam__f1-r+qXqYf0.95a-f0Z-Zf0.05nm+f0/-Xf0f0.95+f0/-Yf0f0.95+f0/-Zf0f1am__f1-r+qXqYf0.95a-f0Z-Zf0.05',float('-0.950000'),float('-0.950000'),float('0.000000'),float('0.950000'),float('0.950000'),float('0.050000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 2 } ], "inspector": [ 464.08475446714334, 1641.3035135544833 ], "name": "d3", "script": [ "import fab.types", "", "title('Difference')", "input('a', fab.types.Shape)", "input('b', fab.types.Shape)", "", "output('shape', a & ~b)", "" ], "uid": 30 }, { "datums": [ { "expr": "0.0", "name": "x", "type": "float", "uid": 0 }, { "expr": "0.0", "name": "y", "type": "float", "uid": 1 }, { "expr": "0", "name": "z", "type": "float", "uid": 2 }, { "expr": "\u0011[__27.__2,__30.__2,__24.__4]", "name": "shape", "type": "_fabtypes.Shape", "uid": 3 }, { "expr": "\u0012fab.types.Shape('m-Xf0-Yf0-Zf-0.22iiaam__f1-r+qXqYf0.95a-f0Z-Zf0.05a= abs( sin(X / 0.06283185307179587)*cos(Y / 0.06283185307179587) + sin(Y / 0.06283185307179587)*cos(Z /0.06283185307179587) + sin(Z / 0.06283185307179587)*cos(X / 0.06283185307179587)) - 0.2;am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f-1Z-Zf1aam__f1-r+qXqYf0.95a-f0Z-Zf0.05nm+f0/-Xf0f0.95+f0/-Yf0f0.95+f0/-Zf0f1am__f1-r+qXqYf0.95a-f0Z-Zf0.05m-Xf0.0054135-Yf0.00733751-Zf0.171348m-Xf0-Yf0-Zf0m+*f0.996195X*f0.0871557Y+*f-0.0871557X*f0.996195Y_m-Xf-0-Yf-0-Zf0m-Xf0-Yf0-Zf0m_+*f0.990268Y*f0.139173Z+*f-0.139173Y*f0.990268Zm-Xf0-Yf-0-Zf-0m-Xf0-Yf0-Zf0m+*f0.992546X*f0.121869ZY+*f-0.121869X*f0.992546Zm-Xf-0-Yf0-Zf-0m+f0/-Xf0f0.25+f0/-Yf0f0.3+f0/-Zf0f0.3m__-*f2f0Ziaam+f0/-Xf0f2+f0/-Yf0f0.5_m-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107Y+*f-0.707107X*f0.707107Y_m-Xf-0-Yf-0-Zf0m+f0/*-Xf0f1+*f0-Zf0*f1-f1Z+f0/*-Yf0f1+*f0-Zf0*f1-f1Z_am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f0Z-Zf1nam__f1aa-f-2X-Xf2a-f-1Y-Yf1a-f0.69Z-Zf1.69nm-Xf0-Yf0-Zf-0.3am+f0/-Xf0f2+f0/-Yf0f0.5_m-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107Y+*f-0.707107X*f0.707107Y_m-Xf-0-Yf-0-Zf0m+f0/*-Xf0f1+*f0-Zf0*f1-f1Z+f0/*-Yf0f1+*f0-Zf0*f1-f1Z_am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f0Z-Zf1nam__f1aa-f-2X-Xf2a-f-1Y-Yf1a-f0.69Z-Zf1.69m-Xf0-Yf0-Zf0.6m+f0/-Xf0f0.4+f0/-Yf0f0.5+f0.55/-Zf0.55f1.6m__-*f2f0Zm+f0/-Xf0f2+f0/-Yf0f0.5_m-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107Y+*f-0.707107X*f0.707107Y_m-Xf-0-Yf-0-Zf0m+f0/*-Xf0f1+*f0-Zf0*f1-f1Z+f0/*-Yf0f1+*f0-Zf0*f1-f1Z_am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f0Z-Zf1',float('-0.950000'),float('-0.950000'),float('-0.458377'),float('0.950000'),float('0.950000'),float('0.458378'))", "name": "out", "type": "_fabtypes.Shape", "uid": 4 } ], "inspector": [ 813.98908350908812, 1551.0704808963806 ], "name": "r8", "script": [ "import fab", "", "title('Recenter')", "", "input('x', float)", "input('y', float)", "input('z', float)", "", "input('shape', fab.types.Shape)", "output('out', fab.shapes.recenter(shape, x, y, z))", "", "# UI", "sb.ui.wireframe([(x, y - 0.3, z),", " (x, y + 0.3, z)], color=sb.color.teal)", "sb.ui.wireframe([(x - 0.3, y, z),", " (x + 0.3, y, z)], color=sb.color.teal)", "sb.ui.wireframe([(x, y, z - 0.3),", " (x, y, z + 0.3)], color=sb.color.teal)", "", "sb.ui.point(x, y, z, color=sb.color.teal)", "" ], "uid": 31 }, { "datums": [ { "expr": "\u0011[__31.__4,__5.__4]", "name": "shape", "type": "_fabtypes.Shape", "uid": 0 }, { "expr": "\u0012fab.types.Shape('im-Xf0-Yf0-Zf-0.22iiaam__f1-r+qXqYf0.95a-f0Z-Zf0.05a= abs( sin(X / 0.06283185307179587)*cos(Y / 0.06283185307179587) + sin(Y / 0.06283185307179587)*cos(Z /0.06283185307179587) + sin(Z / 0.06283185307179587)*cos(X / 0.06283185307179587)) - 0.2;am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f-1Z-Zf1aam__f1-r+qXqYf0.95a-f0Z-Zf0.05nm+f0/-Xf0f0.95+f0/-Yf0f0.95+f0/-Zf0f1am__f1-r+qXqYf0.95a-f0Z-Zf0.05m-Xf0.0054135-Yf0.00733751-Zf0.171348m-Xf0-Yf0-Zf0m+*f0.996195X*f0.0871557Y+*f-0.0871557X*f0.996195Y_m-Xf-0-Yf-0-Zf0m-Xf0-Yf0-Zf0m_+*f0.990268Y*f0.139173Z+*f-0.139173Y*f0.990268Zm-Xf0-Yf-0-Zf-0m-Xf0-Yf0-Zf0m+*f0.992546X*f0.121869ZY+*f-0.121869X*f0.992546Zm-Xf-0-Yf0-Zf-0m+f0/-Xf0f0.25+f0/-Yf0f0.3+f0/-Zf0f0.3m__-*f2f0Ziaam+f0/-Xf0f2+f0/-Yf0f0.5_m-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107Y+*f-0.707107X*f0.707107Y_m-Xf-0-Yf-0-Zf0m+f0/*-Xf0f1+*f0-Zf0*f1-f1Z+f0/*-Yf0f1+*f0-Zf0*f1-f1Z_am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f0Z-Zf1nam__f1aa-f-2X-Xf2a-f-1Y-Yf1a-f0.69Z-Zf1.69nm-Xf0-Yf0-Zf-0.3am+f0/-Xf0f2+f0/-Yf0f0.5_m-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107Y+*f-0.707107X*f0.707107Y_m-Xf-0-Yf-0-Zf0m+f0/*-Xf0f1+*f0-Zf0*f1-f1Z+f0/*-Yf0f1+*f0-Zf0*f1-f1Z_am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f0Z-Zf1nam__f1aa-f-2X-Xf2a-f-1Y-Yf1a-f0.69Z-Zf1.69m-Xf0-Yf0-Zf0.6m+f0/-Xf0f0.4+f0/-Yf0f0.5+f0.55/-Zf0.55f1.6m__-*f2f0Zm+f0/-Xf0f2+f0/-Yf0f0.5_m-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107Y+*f-0.707107X*f0.707107Y_m-Xf-0-Yf-0-Zf0m+f0/*-Xf0f1+*f0-Zf0*f1-f1Z+f0/*-Yf0f1+*f0-Zf0*f1-f1Z_am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f0Z-Zf1m-Xf0-Yf0-Zf0aa-r++qXqYqZf1n-r++qXqYqZf0.9a= abs( sin(X/0.10471975511965977) * sin(Y/0.10471975511965977) * sin(Z/0.10471975511965977) + sin(X/0.10471975511965977) * cos(Y/0.10471975511965977) * cos(Z/0.10471975511965977) + cos(X/0.10471975511965977) * sin(X/0.10471975511965977) * cos(Z/0.10471975511965977) + cos(X/0.10471975511965977) * cos(Y/0.10471975511965977) * sin(Z/0.10471975511965977)) - 0.2;am__f1aa-f-1X-Xf1a-f-1Y-Yf1a-f-1Z-Zf1',float('-1.000000'),float('-1.000000'),float('-1.000000'),float('1.000000'),float('1.000000'),float('1.000000'))", "name": "out", "type": "_fabtypes.Shape", "uid": 1 } ], "inspector": [ 1374.423455942826, 1556.8950924919804 ], "name": "m0", "script": [ "import fab", "", "title('Mesh (.stl)')", "", "input('shape', fab.types.Shape)", "output('out', shape)", "", "sb.export.stl(shape)", "" ], "uid": 32 } ], "protocol": 6, "type": "sb" }