{ "nodes": [ { "datums": [ { "expr": "0.0", "name": "x", "subdatum": [ -399, -273 ], "type": "float", "uid": 0 }, { "expr": "0.0", "name": "y", "subdatum": [ -399, -235 ], "type": "float", "uid": 1 }, { "expr": "case.z + case.h - case.d", "name": "z", "subdatum": [ -399, -195 ], "type": "float", "uid": 2 }, { "expr": "1", "name": "ro", "subdatum": [ -401, -155 ], "type": "float", "uid": 3 }, { "expr": "0.9*cup.ro", "name": "ri", "subdatum": [ -401, -115 ], "type": "float", "uid": 4 }, { "expr": "case.d - glass.d", "name": "h", "subdatum": [ -398.7963979999999, -73.146072999999973 ], "type": "float", "uid": 5 }, { "expr": "\u0013[__4.__2]", "name": "shape", "subdatum": [ 569, 48 ], "type": "_fabtypes.Shape", "uid": 6 } ], "inspector": [ -614.49686577289526, -767.74529865934289 ], "name": "cup", "subgraph": [ { "datums": [ { "expr": "\u0011[__parent.__0]", "name": "x", "type": "float", "uid": 0 }, { "expr": "\u0011[__parent.__1]", "name": "y", "type": "float", "uid": 1 }, { "expr": "\u0011[__parent.__2]", "name": "z", "type": "float", "uid": 6 }, { "expr": "\u0011[__parent.__5]", "name": "h", "type": "float", "uid": 8 }, { "expr": "\u0011[__parent.__3]", "name": "r", "type": "float", "uid": 4 }, { "expr": "\u0012fab.types.Shape('am__f1-r+qXqYf1a-f0.3Z-Zf2.9',float('-1.000000'),float('-1.000000'),float('0.300000'),float('1.000000'),float('1.000000'),float('2.900000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 5 } ], "inspector": [ -32.06403199999999, -268.53626799999989 ], "name": "outerCyl", "script": [ "import fab", "import math", "", "title('Cylinder (Z)')", "", "input('x', float)", "input('y', float)", "input('z', float)", "input('h', float)", "input('r', float)", "", "zmin = z", "zmax = z+h", "", "output('shape', fab.shapes.cylinder(x, y, zmin, zmax, r))", "", "# UI", "sb.ui.wireframe([(x, y, zmin), (x, y, zmax)])", "sb.ui.wireframe([(x, y, zmin), (x+r, y, zmin)])", "", "sb.ui.wireframe([", " (math.cos(i/36. * 2*math.pi) * r + x,", " math.sin(i/36. * 2*math.pi) * r + y, zmin)", " for i in range(36)], close=True)", "", "sb.ui.wireframe([", " (math.cos(i/36. * 2*math.pi) * r + x,", " math.sin(i/36. * 2*math.pi) * r + y, zmax)", " for i in range(36)], close=True)", "", "sb.ui.point(x, y, zmin)", "sb.ui.point(x, y, zmax)", "sb.ui.point(x + r, y, zmin, drag=(r, None, None))", "" ], "uid": 0 }, { "datums": [ { "expr": "\u0011[__parent.__0]", "name": "x", "type": "float", "uid": 0 }, { "expr": "\u0011[__parent.__1]", "name": "y", "type": "float", "uid": 1 }, { "expr": "\u0011[__parent.__2]", "name": "z", "type": "float", "uid": 6 }, { "expr": "\u0011[__parent.__5]", "name": "h", "type": "float", "uid": 7 }, { "expr": "\u0011[__parent.__3]", "name": "ro", "type": "float", "uid": 8 }, { "expr": "\u0011[__parent.__4]", "name": "ri", "type": "float", "uid": 9 }, { "expr": "\u0012fab.types.Shape('am__f1-r+qXqYf0.9a-f1.4Z-Zf2.9',float('-0.900000'),float('-0.900000'),float('1.400000'),float('0.900000'),float('0.900000'),float('2.900000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 5 } ], "inspector": [ -31.062031000000019, -29.060029999999998 ], "name": "innerCyl", "script": [ "import fab", "import math", "", "title('Cylinder (Z)')", "", "input('x', float)", "input('y', float)", "input('z', float)", "input('h', float)", "input('ro', float)", "input('ri', float)", "", "zmin = z + 2*ro - ri", "zmax = z + h", "r = ri", "", "output('shape', fab.shapes.cylinder(x, y, zmin, zmax, r))", "", "# UI", "sb.ui.wireframe([(x, y, zmin), (x, y, zmax)])", "sb.ui.wireframe([(x, y, zmin), (x+r, y, zmin)])", "", "sb.ui.wireframe([", " (math.cos(i/36. * 2*math.pi) * r + x,", " math.sin(i/36. * 2*math.pi) * r + y, zmin)", " for i in range(36)], close=True)", "", "sb.ui.wireframe([", " (math.cos(i/36. * 2*math.pi) * r + x,", " math.sin(i/36. * 2*math.pi) * r + y, zmax)", " for i in range(36)], close=True)", "", "sb.ui.point(x, y, zmin)", "sb.ui.point(x, y, zmax)", "sb.ui.point(x + r, y, zmin, drag=(r, None, None))", "" ], "uid": 1 }, { "datums": [ { "expr": "\u0011[__parent.__0]", "name": "x", "type": "float", "uid": 0 }, { "expr": "\u0011[__parent.__1]", "name": "y", "type": "float", "uid": 1 }, { "expr": "\u0011[__parent.__2]", "name": "z", "type": "float", "uid": 2 }, { "expr": "\u0011[__parent.__3]", "name": "ro", "type": "float", "uid": 5 }, { "expr": "\u0011[__parent.__4]", "name": "ri", "type": "float", "uid": 6 }, { "expr": "\u0012fab.types.Shape('-r++qXqYq-Zf1.4f0.9',float('-0.900000'),float('-0.900000'),float('0.500000'),float('0.900000'),float('0.900000'),float('2.300000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 4 } ], "inspector": [ -30.060029999999983, 232.46223099999992 ], "name": "innerSph", "script": [ "import fab", "import math", "", "title('Sphere (center)')", "", "input('x', float)", "input('y', float)", "input('z', float)", "input('ro', float)", "input('ri', float)", "", "zc = z + 2*ro - ri", "r = ri", "", "output('shape', fab.shapes.sphere(x, y, zc, r))", "", "# UI", "sb.ui.wireframe([", " (math.cos(i/36. * 2*math.pi) * r + x,", " math.sin(i/36. * 2*math.pi) * r + y, zc)", " for i in range(36)], close=True)", "sb.ui.wireframe([(x,y,zc-r), (x,y,zc+r)])", "", "sb.ui.point(x, y, zc)", "sb.ui.point(x, y, zc + r, drag=(None, None, r))", "sb.ui.point(x, y, zc - r, drag=(None, None, r))", "" ], "uid": 2 }, { "datums": [ { "expr": "\u0011[__1.__5]", "name": "a", "type": "_fabtypes.Shape", "uid": 0 }, { "expr": "\u0011[__2.__4]", "name": "b", "type": "_fabtypes.Shape", "uid": 1 }, { "expr": "\u0012fab.types.Shape('iam__f1-r+qXqYf0.9a-f1.4Z-Zf2.9-r++qXqYq-Zf1.4f0.9',float('-0.900000'),float('-0.900000'),float('0.500000'),float('0.900000'),float('0.900000'),float('2.900000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 2 } ], "inspector": [ 267.56228099999998, 74.230114999999955 ], "name": "inner", "script": [ "import fab.types", "", "title('Union')", "input('a', fab.types.Shape)", "input('b', fab.types.Shape)", "", "output('shape', a | b)", "" ], "uid": 3 }, { "datums": [ { "expr": "\u0011[__0.__5]", "name": "a", "type": "_fabtypes.Shape", "uid": 0 }, { "expr": "\u0011[__3.__2]", "name": "b", "type": "_fabtypes.Shape", "uid": 1 }, { "expr": "\u0012fab.types.Shape('aam__f1-r+qXqYf1a-f0.3Z-Zf2.9niam__f1-r+qXqYf0.9a-f1.4Z-Zf2.9-r++qXqYq-Zf1.4f0.9',float('-1.000000'),float('-1.000000'),float('0.300000'),float('1.000000'),float('1.000000'),float('2.900000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 2 } ], "inspector": [ 271.60830399999986, -68.230114999999955 ], "name": "diff", "script": [ "import fab.types", "", "title('Difference')", "input('a', fab.types.Shape)", "input('b', fab.types.Shape)", "", "output('shape', a & ~b)", "" ], "uid": 4 } ], "uid": 0 }, { "datums": [ { "expr": "0.0", "name": "x", "subdatum": [ -461.24970388938294, -331.08149729739807 ], "type": "float", "uid": 0 }, { "expr": "0.0", "name": "y", "subdatum": [ -460.24970388938294, -289.08149729739819 ], "type": "float", "uid": 1 }, { "expr": "0.0", "name": "z", "subdatum": [ -460.24970388938294, -247.08149729739819 ], "type": "float", "uid": 2 }, { "expr": "maze.r*(2**(1/2))", "name": "r", "subdatum": [ -462.14923759313643, -202.2780857550506 ], "type": "float", "uid": 3 }, { "expr": "3", "name": "h", "subdatum": [ -462.14923759313643, -160.13681788941506 ], "type": "float", "uid": 4 }, { "expr": "2.7", "name": "d", "subdatum": [ -460.74452866428192, -119.40025895263403 ], "type": "float", "uid": 5 }, { "expr": "\u0013[__4.__2]", "name": "shape", "subdatum": [ 490.24341617022679, -147.49443752972439 ], "type": "_fabtypes.Shape", "uid": 6 } ], "inspector": [ -607.6547772021504, -512.40035480191113 ], "name": "case", "subgraph": [ { "datums": [ { "expr": "\u0011[__parent.__0]", "name": "x", "type": "float", "uid": 0 }, { "expr": "\u0011[__parent.__1]", "name": "y", "type": "float", "uid": 1 }, { "expr": "8", "name": "N", "type": "int", "uid": 2 }, { "expr": "\u0011[__parent.__3]", "name": "ro", "type": "float", "uid": 5 }, { "expr": "\u0012fab.types.Shape('m-Xf0-Yf0-Zf0aaaaaaam-Xf0-Yf0-Zf0m+*f1X*f0Y+*f-0X*f1Y_m-Xf0-Yf0-Zf0-f-9.9912Ym-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107Y+*f-0.707107X*f0.707107Y_m-Xf0-Yf0-Zf0-f-9.9912Ym-Xf0-Yf0-Zf0m+*f6.12323e-17X*f1Y+*f-1X*f6.12323e-17Y_m-Xf0-Yf0-Zf0-f-9.9912Ym-Xf0-Yf0-Zf0m+*f-0.707107X*f0.707107Y+*f-0.707107X*f-0.707107Y_m-Xf0-Yf0-Zf0-f-9.9912Ym-Xf0-Yf0-Zf0m+*f-1X*f1.22465e-16Y+*f-1.22465e-16X*f-1Y_m-Xf0-Yf0-Zf0-f-9.9912Ym-Xf0-Yf0-Zf0m+*f-0.707107X*f-0.707107Y+*f0.707107X*f-0.707107Y_m-Xf0-Yf0-Zf0-f-9.9912Ym-Xf0-Yf0-Zf0m+*f-1.83697e-16X*f-1Y+*f1X*f-1.83697e-16Y_m-Xf0-Yf0-Zf0-f-9.9912Ym-Xf0-Yf0-Zf0m+*f0.707107X*f-0.707107Y+*f0.707107X*f0.707107Y_m-Xf0-Yf0-Zf0-f-9.9912Y',float('-10.814397'),float('-10.814397'),float('-inf'),float('10.814397'),float('10.814397'),float('inf'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 4 } ], "inspector": [ -92.634683717834719, -410.04738220201398 ], "name": "outerOct", "script": [ "# Neil Gershenfeld 2/14/15", "# Matt Keeter 6/12/15", "", "import fab", "import math", "", "title('Polygon')", "", "input('x', float)", "input('y', float)", "input('N', int)", "input('ro', float)", "", "r = ro / math.cos(math.pi/16)", "", "output('shape', fab.shapes.move(fab.shapes.polygon_radius(x, y, r, N), x, y))", "", "# UI", "# (we need to do a bit of work to make the UI work for both even and", "# odd vertex counts; otherwise it will be off for one or the other)", "a_ = 0 if (N % 2) else (math.pi / N)", "sb.ui.wireframe([", " (x + r * math.sin(a_ + a * math.pi * 2/N),", " y + r * math.cos(a_ + a * math.pi * 2/N), 0)", " for a in range(N)], close=True)", "sb.ui.point(x, y)", "sb.ui.point(x + r * math.sin(a_), y + r * math.cos(a_),", " drag=(None, ro, None))", "" ], "uid": 0 }, { "datums": [ { "expr": "\u0011[__0.__0]", "name": "x", "type": "float", "uid": 0 }, { "expr": "\u0011[__0.__1]", "name": "y", "type": "float", "uid": 1 }, { "expr": "0.0", "name": "_z", "type": "float", "uid": 2 }, { "expr": "22.5", "name": "a", "type": "float", "uid": 3 }, { "expr": "\u0011[__0.__4]", "name": "shape", "type": "_fabtypes.Shape", "uid": 4 }, { "expr": "\u0012fab.types.Shape('m-Xf0-Yf0-Zf0m+*f0.92388X*f0.382683Y+*f-0.382683X*f0.92388Y_m-Xf-0-Yf-0-Zf0m-Xf0-Yf0-Zf0aaaaaaam-Xf0-Yf0-Zf0m+*f1X*f0Y+*f-0X*f1Y_m-Xf0-Yf0-Zf0-f-9.9912Ym-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107Y+*f-0.707107X*f0.707107Y_m-Xf0-Yf0-Zf0-f-9.9912Ym-Xf0-Yf0-Zf0m+*f6.12323e-17X*f1Y+*f-1X*f6.12323e-17Y_m-Xf0-Yf0-Zf0-f-9.9912Ym-Xf0-Yf0-Zf0m+*f-0.707107X*f0.707107Y+*f-0.707107X*f-0.707107Y_m-Xf0-Yf0-Zf0-f-9.9912Ym-Xf0-Yf0-Zf0m+*f-1X*f1.22465e-16Y+*f-1.22465e-16X*f-1Y_m-Xf0-Yf0-Zf0-f-9.9912Ym-Xf0-Yf0-Zf0m+*f-0.707107X*f-0.707107Y+*f0.707107X*f-0.707107Y_m-Xf0-Yf0-Zf0-f-9.9912Ym-Xf0-Yf0-Zf0m+*f-1.83697e-16X*f-1Y+*f1X*f-1.83697e-16Y_m-Xf0-Yf0-Zf0-f-9.9912Ym-Xf0-Yf0-Zf0m+*f0.707107X*f-0.707107Y+*f0.707107X*f0.707107Y_m-Xf0-Yf0-Zf0-f-9.9912Y',float('-14.129691'),float('-14.129691'),float('-inf'),float('14.129691'),float('14.129691'),float('inf'))", "name": "rotated", "type": "_fabtypes.Shape", "uid": 5 } ], "inspector": [ 205.36531628216528, -335.04738220201398 ], "name": "rotOct", "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": 1 }, { "datums": [ { "expr": "0.0", "name": "_x", "type": "float", "uid": 0 }, { "expr": "0.0", "name": "_y", "type": "float", "uid": 1 }, { "expr": "\u0011[__parent.__2]", "name": "z", "type": "float", "uid": 6 }, { "expr": "\u0011[__parent.__4]", "name": "h", "type": "float", "uid": 7 }, { "expr": "\u0011[__1.__5]", "name": "shape", "type": "_fabtypes.Shape", "uid": 4 }, { "expr": "\u0012fab.types.Shape('am__f1m-Xf0-Yf0-Zf0m+*f0.92388X*f0.382683Y+*f-0.382683X*f0.92388Y_m-Xf-0-Yf-0-Zf0m-Xf0-Yf0-Zf0aaaaaaam-Xf0-Yf0-Zf0m+*f1X*f0Y+*f-0X*f1Y_m-Xf0-Yf0-Zf0-f-9.9912Ym-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107Y+*f-0.707107X*f0.707107Y_m-Xf0-Yf0-Zf0-f-9.9912Ym-Xf0-Yf0-Zf0m+*f6.12323e-17X*f1Y+*f-1X*f6.12323e-17Y_m-Xf0-Yf0-Zf0-f-9.9912Ym-Xf0-Yf0-Zf0m+*f-0.707107X*f0.707107Y+*f-0.707107X*f-0.707107Y_m-Xf0-Yf0-Zf0-f-9.9912Ym-Xf0-Yf0-Zf0m+*f-1X*f1.22465e-16Y+*f-1.22465e-16X*f-1Y_m-Xf0-Yf0-Zf0-f-9.9912Ym-Xf0-Yf0-Zf0m+*f-0.707107X*f-0.707107Y+*f0.707107X*f-0.707107Y_m-Xf0-Yf0-Zf0-f-9.9912Ym-Xf0-Yf0-Zf0m+*f-1.83697e-16X*f-1Y+*f1X*f-1.83697e-16Y_m-Xf0-Yf0-Zf0-f-9.9912Ym-Xf0-Yf0-Zf0m+*f0.707107X*f-0.707107Y+*f0.707107X*f0.707107Y_m-Xf0-Yf0-Zf0-f-9.9912Ya-f0Z-Zf3',float('-14.129691'),float('-14.129691'),float('0.000000'),float('14.129691'),float('14.129691'),float('3.000000'))", "name": "out", "type": "_fabtypes.Shape", "uid": 5 } ], "inspector": [ -83.797678312630978, -222.66240237356237 ], "name": "outerOctPrism", "script": [ "import fab", "", "title('Extrude')", "", "input('_x', float)", "input('_y', float)", "input('z', float)", "input('h', float)", "", "zmin = z", "zmax = z + h", "", "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": 2 }, { "datums": [ { "expr": "\u0011[__parent.__0]", "name": "x", "type": "float", "uid": 0 }, { "expr": "\u0011[__parent.__1]", "name": "y", "type": "float", "uid": 1 }, { "expr": "\u0011[__parent.__2]", "name": "z", "type": "float", "uid": 2 }, { "expr": "\u0011[__parent.__3]", "name": "r", "type": "float", "uid": 7 }, { "expr": "\u0011[__parent.__4]", "name": "h", "type": "float", "uid": 3 }, { "expr": "\u0011[__parent.__5]", "name": "d", "type": "float", "uid": 4 }, { "expr": "\u0012fab.types.Shape('am__f1aa-f-7.5X-Xf7.5a-f-7.5Y-Yf7.5a-f0.3Z-Zf3.01',float('-7.500000'),float('-7.500000'),float('0.300000'),float('7.500000'),float('7.500000'),float('3.010000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 6 } ], "inspector": [ -99.360104284976785, -64.643923269743937 ], "name": "innerSq", "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('r', float)", "input('h', float)", "input('d', float)", "", "zc = z + h - d/2", "width = r * (2**(1/2))", "height = width", "depth = d", "", "xmin, xmax = x - width/2, x + width/2", "ymin, ymax = y - height/2, y + height/2", "zmin, zmax = zc - depth/2, zc + depth/2 + 0.01", "", "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, zc)", "sb.ui.point(x + width/2.0, y + height/2.0, zc + depth/2.0,", " drag=drag_hwd)", "", "" ], "uid": 3 }, { "datums": [ { "expr": "\u0011[__2.__5]", "name": "a", "type": "_fabtypes.Shape", "uid": 0 }, { "expr": "\u0011[__3.__6]", "name": "b", "type": "_fabtypes.Shape", "uid": 1 }, { "expr": "\u0012fab.types.Shape('aam__f1m-Xf0-Yf0-Zf0m+*f0.92388X*f0.382683Y+*f-0.382683X*f0.92388Y_m-Xf-0-Yf-0-Zf0m-Xf0-Yf0-Zf0aaaaaaam-Xf0-Yf0-Zf0m+*f1X*f0Y+*f-0X*f1Y_m-Xf0-Yf0-Zf0-f-9.9912Ym-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107Y+*f-0.707107X*f0.707107Y_m-Xf0-Yf0-Zf0-f-9.9912Ym-Xf0-Yf0-Zf0m+*f6.12323e-17X*f1Y+*f-1X*f6.12323e-17Y_m-Xf0-Yf0-Zf0-f-9.9912Ym-Xf0-Yf0-Zf0m+*f-0.707107X*f0.707107Y+*f-0.707107X*f-0.707107Y_m-Xf0-Yf0-Zf0-f-9.9912Ym-Xf0-Yf0-Zf0m+*f-1X*f1.22465e-16Y+*f-1.22465e-16X*f-1Y_m-Xf0-Yf0-Zf0-f-9.9912Ym-Xf0-Yf0-Zf0m+*f-0.707107X*f-0.707107Y+*f0.707107X*f-0.707107Y_m-Xf0-Yf0-Zf0-f-9.9912Ym-Xf0-Yf0-Zf0m+*f-1.83697e-16X*f-1Y+*f1X*f-1.83697e-16Y_m-Xf0-Yf0-Zf0-f-9.9912Ym-Xf0-Yf0-Zf0m+*f0.707107X*f-0.707107Y+*f0.707107X*f0.707107Y_m-Xf0-Yf0-Zf0-f-9.9912Ya-f0Z-Zf3nam__f1aa-f-7.5X-Xf7.5a-f-7.5Y-Yf7.5a-f0.3Z-Zf3.01',float('-14.129691'),float('-14.129691'),float('0.000000'),float('14.129691'),float('14.129691'),float('3.000000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 2 } ], "inspector": [ 200.28263454229921, -130.55200197796853 ], "name": "d0", "script": [ "import fab.types", "", "title('Difference')", "input('a', fab.types.Shape)", "input('b', fab.types.Shape)", "", "output('shape', a & ~b)", "" ], "uid": 4 } ], "uid": 1 }, { "datums": [ { "expr": "\u0011[__1.__6]", "name": "shape", "type": "_fabtypes.Shape", "uid": 0 }, { "expr": "182", "name": "r", "type": "int", "uid": 1 }, { "expr": "155", "name": "g", "type": "int", "uid": 2 }, { "expr": "76", "name": "b", "type": "int", "uid": 3 }, { "expr": "\u0012fab.types.Shape('aam__f1m-Xf0-Yf0-Zf0m+*f0.92388X*f0.382683Y+*f-0.382683X*f0.92388Y_m-Xf-0-Yf-0-Zf0m-Xf0-Yf0-Zf0aaaaaaam-Xf0-Yf0-Zf0m+*f1X*f0Y+*f-0X*f1Y_m-Xf0-Yf0-Zf0-f-9.9912Ym-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107Y+*f-0.707107X*f0.707107Y_m-Xf0-Yf0-Zf0-f-9.9912Ym-Xf0-Yf0-Zf0m+*f6.12323e-17X*f1Y+*f-1X*f6.12323e-17Y_m-Xf0-Yf0-Zf0-f-9.9912Ym-Xf0-Yf0-Zf0m+*f-0.707107X*f0.707107Y+*f-0.707107X*f-0.707107Y_m-Xf0-Yf0-Zf0-f-9.9912Ym-Xf0-Yf0-Zf0m+*f-1X*f1.22465e-16Y+*f-1.22465e-16X*f-1Y_m-Xf0-Yf0-Zf0-f-9.9912Ym-Xf0-Yf0-Zf0m+*f-0.707107X*f-0.707107Y+*f0.707107X*f-0.707107Y_m-Xf0-Yf0-Zf0-f-9.9912Ym-Xf0-Yf0-Zf0m+*f-1.83697e-16X*f-1Y+*f1X*f-1.83697e-16Y_m-Xf0-Yf0-Zf0-f-9.9912Ym-Xf0-Yf0-Zf0m+*f0.707107X*f-0.707107Y+*f0.707107X*f0.707107Y_m-Xf0-Yf0-Zf0-f-9.9912Ya-f0Z-Zf3nam__f1aa-f-7.5X-Xf7.5a-f-7.5Y-Yf7.5a-f0.3Z-Zf3.01',float('-14.129691'),float('-14.129691'),float('0.000000'),float('14.129691'),float('14.129691'),float('3.000000'),color=(182,155,76))", "name": "out", "type": "_fabtypes.Shape", "uid": 4 } ], "inspector": [ -302.95888518151628, -481.23176395197441 ], "name": "s0", "script": [ "import fab", "import math", "", "title('Set color (RGB)')", "", "input(\"shape\", fab.types.Shape)", "input(\"r\", int)", "input(\"g\", int)", "input(\"b\", int)", "", "output(\"out\", fab.shapes.set_color(shape, r, g, b))", "" ], "uid": 2 }, { "datums": [ { "expr": "case.x", "name": "x", "subdatum": [ -412, -298 ], "type": "float", "uid": 0 }, { "expr": "case.y", "name": "y", "subdatum": [ -410, -259 ], "type": "float", "uid": 1 }, { "expr": "case.z + case.h - glass.d/2 + 10", "name": "z", "subdatum": [ -411, -219 ], "type": "float", "uid": 2 }, { "expr": "case.r", "name": "ro", "subdatum": [ -411, -181 ], "type": "float", "uid": 3 }, { "expr": "cup.ri", "name": "ri", "subdatum": [ -410, -142 ], "type": "float", "uid": 4 }, { "expr": "0.1", "name": "d", "subdatum": [ -412, -103 ], "type": "float", "uid": 5 }, { "expr": "\u0013[__2.__2]", "name": "shape", "subdatum": [ 484, -83 ], "type": "_fabtypes.Shape", "uid": 6 } ], "inspector": [ -605.94785355140516, -267.40636959729227 ], "name": "glass", "subgraph": [ { "datums": [ { "expr": "\u0011[__parent.__0]", "name": "x", "type": "float", "uid": 0 }, { "expr": "\u0011[__parent.__1]", "name": "y", "type": "float", "uid": 1 }, { "expr": "\u0011[__parent.__2]", "name": "z", "type": "float", "uid": 2 }, { "expr": "\u0011[__parent.__3]", "name": "r", "type": "float", "uid": 7 }, { "expr": "\u0011[__parent.__5]", "name": "depth", "type": "float", "uid": 5 }, { "expr": "\u0012fab.types.Shape('am__f1aa-f-7.5X-Xf7.5a-f-7.5Y-Yf7.5a-f12.9Z-Zf13',float('-7.500000'),float('-7.500000'),float('12.900000'),float('7.500000'),float('7.500000'),float('13.000000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 6 } ], "inspector": [ -99, -284 ], "name": "glass", "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('r', float)", "input('depth', float)", "", "width = r * (2**(1/2))", "height = width", "", "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": 0 }, { "datums": [ { "expr": "\u0011[__parent.__0]", "name": "x", "type": "float", "uid": 0 }, { "expr": "\u0011[__parent.__1]", "name": "y", "type": "float", "uid": 1 }, { "expr": "\u0011[__parent.__2]", "name": "z", "type": "float", "uid": 6 }, { "expr": "\u0011[__parent.__4]", "name": "r", "type": "float", "uid": 4 }, { "expr": "\u0011[__parent.__5]", "name": "d", "type": "float", "uid": 7 }, { "expr": "\u0012fab.types.Shape('am__f1-r+qXqYf0.9a-f12.9Z-Zf13',float('-0.900000'),float('-0.900000'),float('12.900000'),float('0.900000'),float('0.900000'),float('13.000000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 5 } ], "inspector": [ -101, -70 ], "name": "hole", "script": [ "import fab", "import math", "", "title('Cylinder (Z)')", "", "input('x', float)", "input('y', float)", "input('z', float)", "input('r', float)", "input('d', float)", "", "zmin = z - d/2", "zmax = z + d/2", "", "output('shape', fab.shapes.cylinder(x, y, zmin, zmax, r))", "", "# UI", "sb.ui.wireframe([(x, y, zmin), (x, y, zmax)])", "sb.ui.wireframe([(x, y, zmin), (x+r, y, zmin)])", "", "sb.ui.wireframe([", " (math.cos(i/36. * 2*math.pi) * r + x,", " math.sin(i/36. * 2*math.pi) * r + y, zmin)", " for i in range(36)], close=True)", "", "sb.ui.wireframe([", " (math.cos(i/36. * 2*math.pi) * r + x,", " math.sin(i/36. * 2*math.pi) * r + y, zmax)", " for i in range(36)], close=True)", "", "sb.ui.point(x, y, zmin)", "sb.ui.point(x, y, zmax)", "sb.ui.point(x + r, y, zmin, drag=(r, None, None))", "" ], "uid": 1 }, { "datums": [ { "expr": "\u0011[__0.__6]", "name": "a", "type": "_fabtypes.Shape", "uid": 0 }, { "expr": "\u0011[__1.__5]", "name": "b", "type": "_fabtypes.Shape", "uid": 1 }, { "expr": "\u0012fab.types.Shape('aam__f1aa-f-7.5X-Xf7.5a-f-7.5Y-Yf7.5a-f12.9Z-Zf13nam__f1-r+qXqYf0.9a-f12.9Z-Zf13',float('-7.500000'),float('-7.500000'),float('12.900000'),float('7.500000'),float('7.500000'),float('13.000000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 2 } ], "inspector": [ 206, -139 ], "name": "diff", "script": [ "import fab.types", "", "title('Difference')", "input('a', fab.types.Shape)", "input('b', fab.types.Shape)", "", "output('shape', a & ~b)", "" ], "uid": 2 } ], "uid": 3 }, { "datums": [ { "expr": "\u0011[__3.__6]", "name": "shape", "type": "_fabtypes.Shape", "uid": 0 }, { "expr": "0", "name": "r", "type": "int", "uid": 1 }, { "expr": "235", "name": "g", "type": "int", "uid": 2 }, { "expr": "255", "name": "b", "type": "int", "uid": 3 }, { "expr": "\u0012fab.types.Shape('aam__f1aa-f-7.5X-Xf7.5a-f-7.5Y-Yf7.5a-f12.9Z-Zf13nam__f1-r+qXqYf0.9a-f12.9Z-Zf13',float('-7.500000'),float('-7.500000'),float('12.900000'),float('7.500000'),float('7.500000'),float('13.000000'),color=(0,235,255))", "name": "out", "type": "_fabtypes.Shape", "uid": 4 } ], "inspector": [ -293.87100611296876, -231.30412745551541 ], "name": "s1", "script": [ "import fab", "import math", "", "title('Set color (RGB)')", "", "input(\"shape\", fab.types.Shape)", "input(\"r\", int)", "input(\"g\", int)", "input(\"b\", int)", "", "output(\"out\", fab.shapes.set_color(shape, r, g, b))", "" ], "uid": 4 }, { "datums": [ { "expr": "case.x", "name": "x", "subdatum": [ -517.27138181020689, -433.92586504794843 ], "type": "float", "uid": 0 }, { "expr": "case.y", "name": "y", "subdatum": [ -515.94843709969484, -391.59163431156327 ], "type": "float", "uid": 1 }, { "expr": "case.z", "name": "z", "subdatum": [ -515.94843709969484, -349.25740357517805 ], "type": "float", "uid": 2 }, { "expr": "7.5", "name": "r", "subdatum": [ -514.6254923891828, -305.60022812828078 ], "type": "float", "uid": 3 }, { "expr": "0.05", "name": "width", "subdatum": [ -517.71725319327231, -260.23553418491611 ], "type": "float", "uid": 4 }, { "expr": "case.d - glass.d", "name": "depth", "subdatum": [ -519.09416078155232, -216.17449135995679 ], "type": "float", "uid": 5 }, { "expr": "\u0013[__14.__2]", "name": "shape", "subdatum": [ 1856.2185121794321, 202.43418155006745 ], "type": "_fabtypes.Shape", "uid": 6 } ], "inspector": [ -604.68186705865628, -12.388022309182581 ], "name": "maze", "subgraph": [ { "datums": [ { "expr": "\u0011[__parent.__0]", "name": "xc", "type": "float", "uid": 7 }, { "expr": "\u0011[__parent.__1]", "name": "yc", "type": "float", "uid": 8 }, { "expr": "\u0011[__parent.__2]", "name": "zc", "type": "float", "uid": 9 }, { "expr": "12", "name": "width", "type": "float", "uid": 3 }, { "expr": "\u0011[__parent.__4]", "name": "height", "type": "float", "uid": 4 }, { "expr": "\u0011[__parent.__5]", "name": "depth", "type": "float", "uid": 5 }, { "expr": "\u0011[__parent.__3]", "name": "r", "type": "float", "uid": 0 }, { "expr": "\u0012fab.types.Shape('am__f1aa-f-4.5X-Xf7.5a-f4.475Y-Yf4.525a-f0Z-Zf2.6',float('-4.500000'),float('4.475000'),float('0.000000'),float('7.500000'),float('4.525000'),float('2.600000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 6 } ], "inspector": [ -52.322488354639233, -411.69536889571384 ], "name": "c0", "script": [ "# Neil Gershenfeld 1/24/15", "# Matt Keeter 5/22/15", "", "import fab", "", "title('Cube (center)')", "", "input('xc', float)", "input('yc', float)", "input('zc', float)", "input('width', float)", "input('height', float)", "input('depth', float)", "input('r', float)", "", "x = xc + 1.5/7.5*r", "y = yc + 4.5/7.5*r", "z = zc + depth/2", "", "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": 0 }, { "datums": [ { "expr": "\u0011[__0.__7]", "name": "xc", "type": "float", "uid": 7 }, { "expr": "\u0011[__0.__8]", "name": "yc", "type": "float", "uid": 8 }, { "expr": "\u0011[__0.__9]", "name": "zc", "type": "float", "uid": 9 }, { "expr": "\u0011[__0.__4]", "name": "width", "type": "float", "uid": 3 }, { "expr": "3", "name": "height", "type": "float", "uid": 4 }, { "expr": "\u0011[__0.__5]", "name": "depth", "type": "float", "uid": 5 }, { "expr": "\u0011[__0.__0]", "name": "r", "type": "float", "uid": 0 }, { "expr": "\u0012fab.types.Shape('am__f1aa-f-4.525X-Xf-4.475a-f1.5Y-Yf4.5a-f0Z-Zf2.6',float('-4.525000'),float('1.500000'),float('0.000000'),float('-4.475000'),float('4.500000'),float('2.600000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 6 } ], "inspector": [ 287.77368595051576, -411.69536889571384 ], "name": "c1", "script": [ "# Neil Gershenfeld 1/24/15", "# Matt Keeter 5/22/15", "", "import fab", "", "title('Cube (center)')", "", "input('xc', float)", "input('yc', float)", "input('zc', float)", "input('width', float)", "input('height', float)", "input('depth', float)", "input('r', float)", "", "x = xc - 4.5/7.5*r", "y = yc + 3/7.5*r", "z = zc + depth/2", "", "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": 1 }, { "datums": [ { "expr": "\u0011[__1.__7]", "name": "xc", "type": "float", "uid": 7 }, { "expr": "\u0011[__1.__8]", "name": "yc", "type": "float", "uid": 8 }, { "expr": "\u0011[__1.__9]", "name": "zc", "type": "float", "uid": 9 }, { "expr": "3", "name": "width", "type": "float", "uid": 3 }, { "expr": "\u0011[__1.__3]", "name": "height", "type": "float", "uid": 4 }, { "expr": "\u0011[__1.__5]", "name": "depth", "type": "float", "uid": 5 }, { "expr": "\u0011[__1.__0]", "name": "r", "type": "float", "uid": 0 }, { "expr": "\u0012fab.types.Shape('am__f1aa-f-4.5X-Xf-1.5a-f1.475Y-Yf1.525a-f0Z-Zf2.6',float('-4.500000'),float('1.475000'),float('0.000000'),float('-1.500000'),float('1.525000'),float('2.600000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 6 } ], "inspector": [ 622.74243985317366, -411.73053874589976 ], "name": "c2", "script": [ "# Neil Gershenfeld 1/24/15", "# Matt Keeter 5/22/15", "", "import fab", "", "title('Cube (center)')", "", "input('xc', float)", "input('yc', float)", "input('zc', float)", "input('width', float)", "input('height', float)", "input('depth', float)", "input('r', float)", "", "x = xc - 3/7.5*r", "y = yc + 1.5/7.5*r", "z = zc + depth/2", "", "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": 2 }, { "datums": [ { "expr": "0.0", "name": "xc", "type": "float", "uid": 7 }, { "expr": "0.0", "name": "yc", "type": "float", "uid": 8 }, { "expr": "0.0", "name": "zc", "type": "float", "uid": 9 }, { "expr": "6", "name": "width", "type": "float", "uid": 3 }, { "expr": "\u0011[__2.__4]", "name": "height", "type": "float", "uid": 4 }, { "expr": "\u0011[__2.__5]", "name": "depth", "type": "float", "uid": 5 }, { "expr": "\u0011[__2.__0]", "name": "r", "type": "float", "uid": 0 }, { "expr": "\u0012fab.types.Shape('am__f1aa-f1.5X-Xf7.5a-f1.475Y-Yf1.525a-f0Z-Zf2.6',float('1.500000'),float('1.475000'),float('0.000000'),float('7.500000'),float('1.525000'),float('2.600000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 6 } ], "inspector": [ 955.55795867277607, -411.73053874590005 ], "name": "c3", "script": [ "# Neil Gershenfeld 1/24/15", "# Matt Keeter 5/22/15", "", "import fab", "", "title('Cube (center)')", "", "input('xc', float)", "input('yc', float)", "input('zc', float)", "input('width', float)", "input('height', float)", "input('depth', float)", "input('r', float)", "", "x = xc + 4.5/7.5*r", "y = yc + 1.5/7.5*r", "z = zc + depth/2", "", "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": 3 }, { "datums": [ { "expr": "0.0", "name": "xc", "type": "float", "uid": 7 }, { "expr": "0.0", "name": "yc", "type": "float", "uid": 8 }, { "expr": "0.0", "name": "zc", "type": "float", "uid": 9 }, { "expr": "6", "name": "width", "type": "float", "uid": 3 }, { "expr": "\u0011[__parent.__4]", "name": "height", "type": "float", "uid": 4 }, { "expr": "\u0011[__parent.__5]", "name": "depth", "type": "float", "uid": 5 }, { "expr": "\u0011[__parent.__3]", "name": "r", "type": "float", "uid": 0 }, { "expr": "\u0012fab.types.Shape('am__f1aa-f-7.5X-Xf-1.5a-f-1.525Y-Yf-1.475a-f0Z-Zf2.6',float('-7.500000'),float('-1.525000'),float('0.000000'),float('-1.500000'),float('-1.475000'),float('2.600000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 6 } ], "inspector": [ -54.897405166120052, -18.870983025853732 ], "name": "c4", "script": [ "# Neil Gershenfeld 1/24/15", "# Matt Keeter 5/22/15", "", "import fab", "", "title('Cube (center)')", "", "input('xc', float)", "input('yc', float)", "input('zc', float)", "input('width', float)", "input('height', float)", "input('depth', float)", "input('r', float)", "", "x = xc - 4.5/7.5*r", "y = yc - 1.5/7.5*r", "z = zc + depth/2", "", "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": 4 }, { "datums": [ { "expr": "\u0011[__4.__7]", "name": "xc", "type": "float", "uid": 7 }, { "expr": "\u0011[__4.__8]", "name": "yc", "type": "float", "uid": 8 }, { "expr": "\u0011[__4.__9]", "name": "zc", "type": "float", "uid": 9 }, { "expr": "\u0011[__4.__4]", "name": "width", "type": "float", "uid": 3 }, { "expr": "3", "name": "height", "type": "float", "uid": 4 }, { "expr": "\u0011[__4.__5]", "name": "depth", "type": "float", "uid": 5 }, { "expr": "\u0011[__4.__0]", "name": "r", "type": "float", "uid": 10 }, { "expr": "\u0012fab.types.Shape('am__f1aa-f-1.525X-Xf-1.475a-f-4.5Y-Yf-1.5a-f0Z-Zf2.6',float('-1.525000'),float('-4.500000'),float('0.000000'),float('-1.475000'),float('-1.500000'),float('2.600000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 6 } ], "inspector": [ 286.49583321068872, -18.870983025853732 ], "name": "c5", "script": [ "# Neil Gershenfeld 1/24/15", "# Matt Keeter 5/22/15", "", "import fab", "", "title('Cube (center)')", "", "input('xc', float)", "input('yc', float)", "input('zc', float)", "input('width', float)", "input('height', float)", "input('depth', float)", "input('r', float)", "", "x = xc - 1.5/7.5*r", "y = yc - 3/7.5*r", "z = zc + depth/2", "", "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": 5 }, { "datums": [ { "expr": "\u0011[__5.__7]", "name": "xc", "type": "float", "uid": 7 }, { "expr": "\u0011[__5.__8]", "name": "yc", "type": "float", "uid": 8 }, { "expr": "\u0011[__5.__9]", "name": "zc", "type": "float", "uid": 9 }, { "expr": "\u0011[__5.__3]", "name": "width", "type": "float", "uid": 3 }, { "expr": "6", "name": "height", "type": "float", "uid": 4 }, { "expr": "\u0011[__5.__5]", "name": "depth", "type": "float", "uid": 5 }, { "expr": "\u0011[__5.__10]", "name": "r", "type": "float", "uid": 10 }, { "expr": "\u0012fab.types.Shape('am__f1aa-f1.475X-Xf1.525a-f-7.5Y-Yf-1.5a-f0Z-Zf2.6',float('1.475000'),float('-7.500000'),float('0.000000'),float('1.525000'),float('-1.500000'),float('2.600000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 6 } ], "inspector": [ 622.74243985317366, -18.870983025853732 ], "name": "c6", "script": [ "# Neil Gershenfeld 1/24/15", "# Matt Keeter 5/22/15", "", "import fab", "", "title('Cube (center)')", "", "input('xc', float)", "input('yc', float)", "input('zc', float)", "input('width', float)", "input('height', float)", "input('depth', float)", "input('r', float)", "", "x = xc + 1.5/7.5*r", "y = yc - 4.5/7.5*r", "z = zc + depth/2", "", "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": 6 }, { "datums": [ { "expr": "\u0011[__6.__7]", "name": "xc", "type": "float", "uid": 7 }, { "expr": "\u0011[__6.__8]", "name": "yc", "type": "float", "uid": 8 }, { "expr": "\u0011[__6.__9]", "name": "zc", "type": "float", "uid": 9 }, { "expr": "\u0011[__6.__3]", "name": "width", "type": "float", "uid": 3 }, { "expr": "3", "name": "height", "type": "float", "uid": 4 }, { "expr": "\u0011[__6.__5]", "name": "depth", "type": "float", "uid": 5 }, { "expr": "\u0011[__6.__10]", "name": "r", "type": "float", "uid": 10 }, { "expr": "\u0012fab.types.Shape('am__f1aa-f-4.525X-Xf-4.475a-f-7.5Y-Yf-4.5a-f0Z-Zf2.6',float('-4.525000'),float('-7.500000'),float('0.000000'),float('-4.475000'),float('-4.500000'),float('2.600000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 6 } ], "inspector": [ 953.84241476133479, -18.870983025853761 ], "name": "c7", "script": [ "# Neil Gershenfeld 1/24/15", "# Matt Keeter 5/22/15", "", "import fab", "", "title('Cube (center)')", "", "input('xc', float)", "input('yc', float)", "input('zc', float)", "input('width', float)", "input('height', float)", "input('depth', float)", "input('r', float)", "", "x = xc - 4.5/7.5*r", "y = yc - 6/7.5*r", "z = zc + depth/2", "", "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": 7 }, { "datums": [ { "expr": "\u0011[__0.__6]", "name": "a", "type": "_fabtypes.Shape", "uid": 0 }, { "expr": "\u0011[__1.__6]", "name": "b", "type": "_fabtypes.Shape", "uid": 1 }, { "expr": "\u0012fab.types.Shape('iam__f1aa-f-4.5X-Xf7.5a-f4.475Y-Yf4.525a-f0Z-Zf2.6am__f1aa-f-4.525X-Xf-4.475a-f1.5Y-Yf4.5a-f0Z-Zf2.6',float('-4.525000'),float('1.500000'),float('0.000000'),float('7.500000'),float('4.525000'),float('2.600000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 2 } ], "inspector": [ 288.21137712212987, -149.25232029538867 ], "name": "u0", "script": [ "import fab.types", "", "title('Union')", "input('a', fab.types.Shape)", "input('b', fab.types.Shape)", "", "output('shape', a | b)", "" ], "uid": 8 }, { "datums": [ { "expr": "\u0011[__2.__6]", "name": "a", "type": "_fabtypes.Shape", "uid": 0 }, { "expr": "\u0011[__3.__6]", "name": "b", "type": "_fabtypes.Shape", "uid": 1 }, { "expr": "\u0012fab.types.Shape('iam__f1aa-f-4.5X-Xf-1.5a-f1.475Y-Yf1.525a-f0Z-Zf2.6am__f1aa-f1.5X-Xf7.5a-f1.475Y-Yf1.525a-f0Z-Zf2.6',float('-4.500000'),float('1.475000'),float('0.000000'),float('7.500000'),float('1.525000'),float('2.600000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 2 } ], "inspector": [ 958.9890464956585, -150.96786420682997 ], "name": "u1", "script": [ "import fab.types", "", "title('Union')", "input('a', fab.types.Shape)", "input('b', fab.types.Shape)", "", "output('shape', a | b)", "" ], "uid": 9 }, { "datums": [ { "expr": "\u0011[__4.__6]", "name": "a", "type": "_fabtypes.Shape", "uid": 0 }, { "expr": "\u0011[__5.__6]", "name": "b", "type": "_fabtypes.Shape", "uid": 1 }, { "expr": "\u0012fab.types.Shape('iam__f1aa-f-7.5X-Xf-1.5a-f-1.525Y-Yf-1.475a-f0Z-Zf2.6am__f1aa-f-1.525X-Xf-1.475a-f-4.5Y-Yf-1.5a-f0Z-Zf2.6',float('-7.500000'),float('-4.500000'),float('0.000000'),float('-1.475000'),float('-1.475000'),float('2.600000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 2 } ], "inspector": [ 289.9269210335712, 243.60723542465746 ], "name": "u2", "script": [ "import fab.types", "", "title('Union')", "input('a', fab.types.Shape)", "input('b', fab.types.Shape)", "", "output('shape', a | b)", "" ], "uid": 10 }, { "datums": [ { "expr": "\u0011[__6.__6]", "name": "a", "type": "_fabtypes.Shape", "uid": 0 }, { "expr": "\u0011[__7.__6]", "name": "b", "type": "_fabtypes.Shape", "uid": 1 }, { "expr": "\u0012fab.types.Shape('iam__f1aa-f1.475X-Xf1.525a-f-7.5Y-Yf-1.5a-f0Z-Zf2.6am__f1aa-f-4.525X-Xf-4.475a-f-7.5Y-Yf-4.5a-f0Z-Zf2.6',float('-4.525000'),float('-7.500000'),float('0.000000'),float('1.525000'),float('-1.500000'),float('2.600000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 2 } ], "inspector": [ 955.55795867277607, 243.60723542465746 ], "name": "u3", "script": [ "import fab.types", "", "title('Union')", "input('a', fab.types.Shape)", "input('b', fab.types.Shape)", "", "output('shape', a | b)", "" ], "uid": 11 }, { "datums": [ { "expr": "\u0011[__8.__2]", "name": "a", "type": "_fabtypes.Shape", "uid": 0 }, { "expr": "\u0011[__9.__2]", "name": "b", "type": "_fabtypes.Shape", "uid": 1 }, { "expr": "\u0012fab.types.Shape('iiam__f1aa-f-4.5X-Xf7.5a-f4.475Y-Yf4.525a-f0Z-Zf2.6am__f1aa-f-4.525X-Xf-4.475a-f1.5Y-Yf4.5a-f0Z-Zf2.6iam__f1aa-f-4.5X-Xf-1.5a-f1.475Y-Yf1.525a-f0Z-Zf2.6am__f1aa-f1.5X-Xf7.5a-f1.475Y-Yf1.525a-f0Z-Zf2.6',float('-4.525000'),float('1.475000'),float('0.000000'),float('7.500000'),float('4.525000'),float('2.600000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 2 } ], "inspector": [ 1281.5113018466136, -70.337300369091253 ], "name": "u4", "script": [ "import fab.types", "", "title('Union')", "input('a', fab.types.Shape)", "input('b', fab.types.Shape)", "", "output('shape', a | b)", "" ], "uid": 12 }, { "datums": [ { "expr": "\u0011[__10.__2]", "name": "a", "type": "_fabtypes.Shape", "uid": 0 }, { "expr": "\u0011[__11.__2]", "name": "b", "type": "_fabtypes.Shape", "uid": 1 }, { "expr": "\u0012fab.types.Shape('iiam__f1aa-f-7.5X-Xf-1.5a-f-1.525Y-Yf-1.475a-f0Z-Zf2.6am__f1aa-f-1.525X-Xf-1.475a-f-4.5Y-Yf-1.5a-f0Z-Zf2.6iam__f1aa-f1.475X-Xf1.525a-f-7.5Y-Yf-1.5a-f0Z-Zf2.6am__f1aa-f-4.525X-Xf-4.475a-f-7.5Y-Yf-4.5a-f0Z-Zf2.6',float('-7.500000'),float('-7.500000'),float('0.000000'),float('1.525000'),float('-1.475000'),float('2.600000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 2 } ], "inspector": [ 1276.3646701122896, 324.23779926239604 ], "name": "u5", "script": [ "import fab.types", "", "title('Union')", "input('a', fab.types.Shape)", "input('b', fab.types.Shape)", "", "output('shape', a | b)", "" ], "uid": 13 }, { "datums": [ { "expr": "\u0011[__12.__2]", "name": "a", "type": "_fabtypes.Shape", "uid": 0 }, { "expr": "\u0011[__13.__2]", "name": "b", "type": "_fabtypes.Shape", "uid": 1 }, { "expr": "\u0012fab.types.Shape('iiiam__f1aa-f-4.5X-Xf7.5a-f4.475Y-Yf4.525a-f0Z-Zf2.6am__f1aa-f-4.525X-Xf-4.475a-f1.5Y-Yf4.5a-f0Z-Zf2.6iam__f1aa-f-4.5X-Xf-1.5a-f1.475Y-Yf1.525a-f0Z-Zf2.6am__f1aa-f1.5X-Xf7.5a-f1.475Y-Yf1.525a-f0Z-Zf2.6iiam__f1aa-f-7.5X-Xf-1.5a-f-1.525Y-Yf-1.475a-f0Z-Zf2.6am__f1aa-f-1.525X-Xf-1.475a-f-4.5Y-Yf-1.5a-f0Z-Zf2.6iam__f1aa-f1.475X-Xf1.525a-f-7.5Y-Yf-1.5a-f0Z-Zf2.6am__f1aa-f-4.525X-Xf-4.475a-f-7.5Y-Yf-4.5a-f0Z-Zf2.6',float('-7.500000'),float('-7.500000'),float('0.000000'),float('7.500000'),float('4.525000'),float('2.600000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 2 } ], "inspector": [ 1561.1449594115372, 126.95024944665248 ], "name": "u6", "script": [ "import fab.types", "", "title('Union')", "input('a', fab.types.Shape)", "input('b', fab.types.Shape)", "", "output('shape', a | b)", "" ], "uid": 14 } ], "uid": 5 }, { "datums": [ { "expr": "\u0011[__5.__6]", "name": "shape", "type": "_fabtypes.Shape", "uid": 0 }, { "expr": "127", "name": "r", "type": "int", "uid": 1 }, { "expr": "127", "name": "g", "type": "int", "uid": 2 }, { "expr": "127", "name": "b", "type": "int", "uid": 3 }, { "expr": "\u0012fab.types.Shape('iiiam__f1aa-f-4.5X-Xf7.5a-f4.475Y-Yf4.525a-f0Z-Zf2.6am__f1aa-f-4.525X-Xf-4.475a-f1.5Y-Yf4.5a-f0Z-Zf2.6iam__f1aa-f-4.5X-Xf-1.5a-f1.475Y-Yf1.525a-f0Z-Zf2.6am__f1aa-f1.5X-Xf7.5a-f1.475Y-Yf1.525a-f0Z-Zf2.6iiam__f1aa-f-7.5X-Xf-1.5a-f-1.525Y-Yf-1.475a-f0Z-Zf2.6am__f1aa-f-1.525X-Xf-1.475a-f-4.5Y-Yf-1.5a-f0Z-Zf2.6iam__f1aa-f1.475X-Xf1.525a-f-7.5Y-Yf-1.5a-f0Z-Zf2.6am__f1aa-f-4.525X-Xf-4.475a-f-7.5Y-Yf-4.5a-f0Z-Zf2.6',float('-7.500000'),float('-7.500000'),float('0.000000'),float('7.500000'),float('4.525000'),float('2.600000'),color=(127,127,127))", "name": "out", "type": "_fabtypes.Shape", "uid": 4 } ], "inspector": [ -293.87875113427094, 19.192081706727897 ], "name": "s2", "script": [ "import fab", "import math", "", "title('Set color (RGB)')", "", "input(\"shape\", fab.types.Shape)", "input(\"r\", int)", "input(\"g\", int)", "input(\"b\", int)", "", "output(\"out\", fab.shapes.set_color(shape, r, g, b))", "" ], "uid": 6 }, { "datums": [ { "expr": "case.x", "name": "x", "subdatum": [ -289, -259 ], "type": "float", "uid": 0 }, { "expr": "case.y", "name": "y", "subdatum": [ -289, -222 ], "type": "float", "uid": 1 }, { "expr": "case.z + case.h", "name": "z", "subdatum": [ -287, -184 ], "type": "float", "uid": 2 }, { "expr": "1.5", "name": "ro", "subdatum": [ -288, -146 ], "type": "float", "uid": 3 }, { "expr": "1.2", "name": "ri", "subdatum": [ -289, -107 ], "type": "float", "uid": 4 }, { "expr": "0.25", "name": "h", "subdatum": [ -289, -69 ], "type": "float", "uid": 5 }, { "expr": "0.6", "name": "d", "subdatum": [ -290, -34 ], "type": "float", "uid": 6 }, { "expr": "\u0013[__4.__2]", "name": "shape", "subdatum": [ 685, 170 ], "type": "_fabtypes.Shape", "uid": 7 } ], "inspector": [ -602.27214705358756, 232.90349580074621 ], "name": "button", "subgraph": [ { "datums": [ { "expr": "\u0011[__parent.__0]", "name": "x", "type": "float", "uid": 0 }, { "expr": "\u0011[__parent.__1]", "name": "y", "type": "float", "uid": 1 }, { "expr": "\u0011[__parent.__2]", "name": "z", "type": "float", "uid": 6 }, { "expr": "\u0011[__parent.__5]", "name": "h", "type": "float", "uid": 7 }, { "expr": "\u0011[__parent.__3]", "name": "r", "type": "float", "uid": 4 }, { "expr": "\u0012fab.types.Shape('am__f1-r+qXqYf1.5a-f3Z-Zf3.25',float('-1.500000'),float('-1.500000'),float('3.000000'),float('1.500000'),float('1.500000'),float('3.250000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 5 } ], "inspector": [ 25, -266 ], "name": "outerCyl", "script": [ "import fab", "import math", "", "title('Cylinder (Z)')", "", "input('x', float)", "input('y', float)", "input('z', float)", "input('h', float)", "input('r', float)", "", "zmin = z", "zmax = z + h", "", "output('shape', fab.shapes.cylinder(x, y, zmin, zmax, r))", "", "# UI", "sb.ui.wireframe([(x, y, zmin), (x, y, zmax)])", "sb.ui.wireframe([(x, y, zmin), (x+r, y, zmin)])", "", "sb.ui.wireframe([", " (math.cos(i/36. * 2*math.pi) * r + x,", " math.sin(i/36. * 2*math.pi) * r + y, zmin)", " for i in range(36)], close=True)", "", "sb.ui.wireframe([", " (math.cos(i/36. * 2*math.pi) * r + x,", " math.sin(i/36. * 2*math.pi) * r + y, zmax)", " for i in range(36)], close=True)", "", "sb.ui.point(x, y, zmin)", "sb.ui.point(x, y, zmax)", "sb.ui.point(x + r, y, zmin, drag=(r, None, None))", "" ], "uid": 0 }, { "datums": [ { "expr": "\u0011[__0.__0]", "name": "x", "type": "float", "uid": 0 }, { "expr": "\u0011[__0.__1]", "name": "y", "type": "float", "uid": 1 }, { "expr": "\u0011[__0.__6]", "name": "zc", "type": "float", "uid": 3 }, { "expr": "\u0011[__0.__7]", "name": "h", "type": "float", "uid": 9 }, { "expr": "\u0011[__0.__4]", "name": "ro", "type": "float", "uid": 7 }, { "expr": "\u0011[__parent.__4]", "name": "ri", "type": "float", "uid": 8 }, { "expr": "\u0012fab.types.Shape('m-Xf0-Yf0-Zf3.25-r+q-f1.35r+qXqYqZf0.15',float('-1.500000'),float('-1.500000'),float('3.100000'),float('1.500000'),float('1.500000'),float('3.400000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 5 } ], "inspector": [ 384, -277 ], "name": "outerTor", "script": [ "# Neil Gershenfeld 1/25/15", "# Matt Keeter 5/31/15", "", "import fab", "import math", "", "title('Torus (Z)')", "", "input('x', float)", "input('y', float)", "input('zc', float)", "input('h', float)", "input('ro', float)", "input('ri', float)", "", "R = (ro + ri)/2", "r = (ro - ri)/2", "z = zc + h", "", "output('shape', fab.shapes.torus_z(x, y, z, R, r))", "", "# UI", "sb.ui.wireframe([", " (x,", " math.sin(i/36. * 2*math.pi) * r + y + R,", " math.cos(i/36. * 2*math.pi) * r + z)", " for i in range(36)], close=True)", "sb.ui.wireframe([", " (math.sin(i/36. * 2*math.pi) * R + x,", " math.cos(i/36. * 2*math.pi) * R + y,", " z)", " for i in range(36)], close=True)", "sb.ui.wireframe([(x, y, z), (x, y, z + R + r)])", "sb.ui.point(x, y, z)", "sb.ui.point(x, y + R, z, drag=(None, ro, None))", "sb.ui.point(x, y + R + r, z, drag=(None, ri, None))", "", "" ], "uid": 1 }, { "datums": [ { "expr": "\u0011[__parent.__0]", "name": "x", "type": "float", "uid": 0 }, { "expr": "\u0011[__parent.__1]", "name": "y", "type": "float", "uid": 1 }, { "expr": "\u0011[__parent.__2]", "name": "z", "type": "float", "uid": 6 }, { "expr": "\u0011[__parent.__6]", "name": "h", "type": "float", "uid": 7 }, { "expr": "\u0011[__parent.__4]", "name": "r", "type": "float", "uid": 4 }, { "expr": "\u0012fab.types.Shape('am__f1-r+qXqYf1.2a-f3Z-Zf3.6',float('-1.200000'),float('-1.200000'),float('3.000000'),float('1.200000'),float('1.200000'),float('3.600000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 5 } ], "inspector": [ 32, -52 ], "name": "innerCyl", "script": [ "import fab", "import math", "", "title('Cylinder (Z)')", "", "input('x', float)", "input('y', float)", "input('z', float)", "input('h', float)", "input('r', float)", "", "zmin = z", "zmax = z + h", "", "output('shape', fab.shapes.cylinder(x, y, zmin, zmax, r))", "", "# UI", "sb.ui.wireframe([(x, y, zmin), (x, y, zmax)])", "sb.ui.wireframe([(x, y, zmin), (x+r, y, zmin)])", "", "sb.ui.wireframe([", " (math.cos(i/36. * 2*math.pi) * r + x,", " math.sin(i/36. * 2*math.pi) * r + y, zmin)", " for i in range(36)], close=True)", "", "sb.ui.wireframe([", " (math.cos(i/36. * 2*math.pi) * r + x,", " math.sin(i/36. * 2*math.pi) * r + y, zmax)", " for i in range(36)], close=True)", "", "sb.ui.point(x, y, zmin)", "sb.ui.point(x, y, zmax)", "sb.ui.point(x + r, y, zmin, drag=(r, None, None))", "" ], "uid": 2 }, { "datums": [ { "expr": "\u0011[__0.__5]", "name": "a", "type": "_fabtypes.Shape", "uid": 0 }, { "expr": "\u0011[__1.__5]", "name": "b", "type": "_fabtypes.Shape", "uid": 1 }, { "expr": "\u0012fab.types.Shape('iam__f1-r+qXqYf1.5a-f3Z-Zf3.25m-Xf0-Yf0-Zf3.25-r+q-f1.35r+qXqYqZf0.15',float('-1.500000'),float('-1.500000'),float('3.000000'),float('1.500000'),float('1.500000'),float('3.400000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 2 } ], "inspector": [ 385, -36 ], "name": "u0", "script": [ "import fab.types", "", "title('Union')", "input('a', fab.types.Shape)", "input('b', fab.types.Shape)", "", "output('shape', a | b)", "" ], "uid": 3 }, { "datums": [ { "expr": "\u0011[__3.__2]", "name": "a", "type": "_fabtypes.Shape", "uid": 0 }, { "expr": "\u0011[__2.__5]", "name": "b", "type": "_fabtypes.Shape", "uid": 1 }, { "expr": "\u0012fab.types.Shape('iiam__f1-r+qXqYf1.5a-f3Z-Zf3.25m-Xf0-Yf0-Zf3.25-r+q-f1.35r+qXqYqZf0.15am__f1-r+qXqYf1.2a-f3Z-Zf3.6',float('-1.500000'),float('-1.500000'),float('3.000000'),float('1.500000'),float('1.500000'),float('3.600000'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 2 } ], "inspector": [ 385, 101 ], "name": "u1", "script": [ "import fab.types", "", "title('Union')", "input('a', fab.types.Shape)", "input('b', fab.types.Shape)", "", "output('shape', a | b)", "" ], "uid": 4 } ], "uid": 7 }, { "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": "maze.r + button.ro", "name": "dx", "type": "float", "uid": 3 }, { "expr": "0", "name": "dy", "type": "float", "uid": 4 }, { "expr": "0", "name": "dz", "type": "float", "uid": 5 }, { "expr": "\u0011[__9.__4]", "name": "shape", "type": "_fabtypes.Shape", "uid": 6 }, { "expr": "\u0012fab.types.Shape('m-Xf9-Yf0-Zf0iiam__f1-r+qXqYf1.5a-f3Z-Zf3.25m-Xf0-Yf0-Zf3.25-r+q-f1.35r+qXqYqZf0.15am__f1-r+qXqYf1.2a-f3Z-Zf3.6',float('7.500000'),float('-1.500000'),float('3.000000'),float('10.500000'),float('1.500000'),float('3.600000'),color=(50,205,50))", "name": "out", "type": "_fabtypes.Shape", "uid": 7 } ], "inspector": [ 22.011922362639353, -232.16543461524526 ], "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))", "", "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": 8 }, { "datums": [ { "expr": "\u0011[__7.__7]", "name": "shape", "type": "_fabtypes.Shape", "uid": 0 }, { "expr": "50", "name": "r", "type": "int", "uid": 1 }, { "expr": "205", "name": "g", "type": "int", "uid": 2 }, { "expr": "50", "name": "b", "type": "int", "uid": 3 }, { "expr": "\u0012fab.types.Shape('iiam__f1-r+qXqYf1.5a-f3Z-Zf3.25m-Xf0-Yf0-Zf3.25-r+q-f1.35r+qXqYqZf0.15am__f1-r+qXqYf1.2a-f3Z-Zf3.6',float('-1.500000'),float('-1.500000'),float('3.000000'),float('1.500000'),float('1.500000'),float('3.600000'),color=(50,205,50))", "name": "out", "type": "_fabtypes.Shape", "uid": 4 } ], "inspector": [ -296, 265 ], "name": "s3", "script": [ "import fab", "import math", "", "title('Set color (RGB)')", "", "input(\"shape\", fab.types.Shape)", "input(\"r\", int)", "input(\"g\", int)", "input(\"b\", int)", "", "output(\"out\", fab.shapes.set_color(shape, r, g, b))", "" ], "uid": 9 }, { "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": "maze.r + button.ro", "name": "dy", "type": "float", "uid": 4 }, { "expr": "0", "name": "dz", "type": "float", "uid": 5 }, { "expr": "\u0011[__9.__4]", "name": "shape", "type": "_fabtypes.Shape", "uid": 6 }, { "expr": "\u0012fab.types.Shape('m-Xf0-Yf9-Zf0iiam__f1-r+qXqYf1.5a-f3Z-Zf3.25m-Xf0-Yf0-Zf3.25-r+q-f1.35r+qXqYqZf0.15am__f1-r+qXqYf1.2a-f3Z-Zf3.6',float('-1.500000'),float('7.500000'),float('3.000000'),float('1.500000'),float('10.500000'),float('3.600000'),color=(50,205,50))", "name": "out", "type": "_fabtypes.Shape", "uid": 7 } ], "inspector": [ 22.725785659294871, -53.356192417474887 ], "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))", "", "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": 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": "-(maze.r + button.ro)", "name": "dx", "type": "float", "uid": 3 }, { "expr": "0", "name": "dy", "type": "float", "uid": 4 }, { "expr": "0", "name": "dz", "type": "float", "uid": 5 }, { "expr": "\u0011[__9.__4]", "name": "shape", "type": "_fabtypes.Shape", "uid": 6 }, { "expr": "\u0012fab.types.Shape('m-Xf-9-Yf0-Zf0iiam__f1-r+qXqYf1.5a-f3Z-Zf3.25m-Xf0-Yf0-Zf3.25-r+q-f1.35r+qXqYqZf0.15am__f1-r+qXqYf1.2a-f3Z-Zf3.6',float('-10.500000'),float('-1.500000'),float('3.000000'),float('-7.500000'),float('1.500000'),float('3.600000'),color=(50,205,50))", "name": "out", "type": "_fabtypes.Shape", "uid": 7 } ], "inspector": [ 22.725785659294871, 121.5335493953595 ], "name": "t2", "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))", "", "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.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": "-(maze.r + button.ro)", "name": "dy", "type": "float", "uid": 4 }, { "expr": "0", "name": "dz", "type": "float", "uid": 5 }, { "expr": "\u0011[__9.__4]", "name": "shape", "type": "_fabtypes.Shape", "uid": 6 }, { "expr": "\u0012fab.types.Shape('m-Xf0-Yf-9-Zf0iiam__f1-r+qXqYf1.5a-f3Z-Zf3.25m-Xf0-Yf0-Zf3.25-r+q-f1.35r+qXqYqZf0.15am__f1-r+qXqYf1.2a-f3Z-Zf3.6',float('-1.500000'),float('-10.500000'),float('3.000000'),float('1.500000'),float('-7.500000'),float('3.600000'),color=(50,205,50))", "name": "out", "type": "_fabtypes.Shape", "uid": 7 } ], "inspector": [ 22.725785659294861, 296.42329120819386 ], "name": "t3", "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))", "", "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": 12 } ], "protocol": 6, "type": "sb" }