{ "nodes": [ { "datums": [ { "expr": "0", "name": "x0", "type": "float", "uid": 0 }, { "expr": "0", "name": "y0", "type": "float", "uid": 1 }, { "expr": "1", "name": "r", "type": "float", "uid": 2 }, { "expr": "0", "name": "_a", "type": "float", "uid": 3 }, { "expr": "\u0012fab.types.Shape('-r+qXqYf1',float('-1.000000'),float('-1.000000'),float('-inf'),float('1.000000'),float('1.000000'),float('inf'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 4 } ], "inspector": [ -198, -155 ], "name": "c0", "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": 0 }, { "datums": [ { "expr": "0.22", "name": "x0", "type": "float", "uid": 0 }, { "expr": "0.009870171546936035", "name": "y0", "type": "float", "uid": 1 }, { "expr": "\u0011[__0.__2]", "name": "x1", "type": "float", "uid": 2 }, { "expr": "4.439514875411987", "name": "y1", "type": "float", "uid": 3 }, { "expr": "\u0012fab.types.Shape('aa-f0.22X-Xf1a-f0.00987017Y-Yf4.43951',float('0.220000'),float('0.009870'),float('-inf'),float('1.000000'),float('4.439515'),float('inf'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 4 } ], "inspector": [ -194, 50 ], "name": "r0", "script": [ "# Neil Gershenfeld 1/24/15", "# Matt Keeter 6/11/15", "", "import fab", "", "title('Rectangle (corner)')", "", "input('x0', float)", "input('y0', float)", "input('x1', float)", "input('y1', float)", "", "output('shape', fab.shapes.rectangle(x0, x1, y0, y1))", "", "# UI", "sb.ui.wireframe([(x0, y0, 0), (x1, y0, 0),", " (x1, y1, 0), (x0, y1, 0)], close=True)", "sb.ui.point(x0, y0)", "sb.ui.point(x1, y1)", "", "" ], "uid": 1 }, { "datums": [ { "expr": "\u0011[__0.__4,__4.__2]", "name": "a", "type": "_fabtypes.Shape", "uid": 0 }, { "expr": "0", "name": "x", "type": "float", "uid": 1 }, { "expr": "\u0012fab.types.Shape('m-Xf0-Yf0-Zf0imr+qXqZ__m-Xf-0-Yf0-Zf0i-r+qXqYf1aaa-f0.22X-Xf1a-f0.00987017Y-Yf4.43951nni-*f0.720955-Xf1.70145*f-1.06358-Yf3.14142i-*f1.14865-Xf0.637865*f1.34337-Yf3.86238-*f-1.86961-Xf1.98124*f-0.279789-Yf5.01103mnr+qXqZ__m-Xf-0-Yf0-Zf0i-r+qXqYf1aaa-f0.22X-Xf1a-f0.00987017Y-Yf4.43951nni-*f0.720955-Xf1.70145*f-1.06358-Yf3.14142i-*f1.14865-Xf0.637865*f1.34337-Yf3.86238-*f-1.86961-Xf1.98124*f-0.279789-Yf5.01103',float('-1.000000'),float('-1.000000'),float('-1.000000'),float('1.000000'),float('4.439515'),float('1.000000'))", "name": "out", "type": "_fabtypes.Shape", "uid": 2 } ], "inspector": [ 197.71658306073058, -58.669283896760874 ], "name": "r1", "script": [ "# Neil Gershenfeld 2/1/15", "# Matt Keeter 6/13/15", "", "import fab", "", "title('Revolve (Y)')", "", "input('a', fab.types.Shape)", "input('x', float)", "", "output('out', fab.shapes.revolve_xy_y(a, x))", "", "" ], "uid": 2 }, { "datums": [ { "expr": "0.6378650069236755", "name": "x0", "type": "float", "uid": 0 }, { "expr": "3.862379729747772", "name": "y0", "type": "float", "uid": 1 }, { "expr": "1.7014491558074951", "name": "x1", "type": "float", "uid": 2 }, { "expr": "3.141424745321274", "name": "y1", "type": "float", "uid": 3 }, { "expr": "1.9812385439872742", "name": "x2", "type": "float", "uid": 4 }, { "expr": "5.011030077934265", "name": "y2", "type": "float", "uid": 5 }, { "expr": "\u0012fab.types.Shape('ni-*f0.720955-Xf1.70145*f-1.06358-Yf3.14142i-*f1.14865-Xf0.637865*f1.34337-Yf3.86238-*f-1.86961-Xf1.98124*f-0.279789-Yf5.01103',float('0.637865'),float('3.141425'),float('-inf'),float('1.981239'),float('5.011030'),float('inf'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 6 } ], "inspector": [ -205.23009944958525, 279.33856197095582 ], "name": "t0", "script": [ "import fab", "", "title('Triangle')", "", "input('x0', float)", "input('y0', float)", "input('x1', float)", "input('y1', float)", "input('x2', float)", "input('y2', float)", "", "output('shape', fab.shapes.triangle(x0, y0, x1, y1, x2, y2))", "", "# UI", "sb.ui.wireframe([(x0, y0, 0), (x1, y1, 0), (x2, y2, 0)], close=True)", "sb.ui.point(x0, y0, 0)", "sb.ui.point(x1, y1, 0)", "sb.ui.point(x2, y2, 0)", "" ], "uid": 3 }, { "datums": [ { "expr": "\u0011[__1.__4]", "name": "a", "type": "_fabtypes.Shape", "uid": 0 }, { "expr": "\u0011[__3.__6]", "name": "b", "type": "_fabtypes.Shape", "uid": 1 }, { "expr": "\u0012fab.types.Shape('aaa-f0.22X-Xf1a-f0.00987017Y-Yf4.43951nni-*f0.720955-Xf1.70145*f-1.06358-Yf3.14142i-*f1.14865-Xf0.637865*f1.34337-Yf3.86238-*f-1.86961-Xf1.98124*f-0.279789-Yf5.01103',float('0.220000'),float('0.009870'),float('-inf'),float('1.000000'),float('4.439515'),float('inf'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 2 } ], "inspector": [ 128.97644492915231, 299.5119665576982 ], "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.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": "90", "name": "a", "type": "float", "uid": 3 }, { "expr": "\u0011[__2.__2]", "name": "shape", "type": "_fabtypes.Shape", "uid": 4 }, { "expr": "\u0012fab.types.Shape('m-Xf0-Yf0-Zf0m_+*f6.12323e-17Y*f1Z+*f-1Y*f6.12323e-17Zm-Xf0-Yf-0-Zf-0m-Xf0-Yf0-Zf0imr+qXqZ__m-Xf-0-Yf0-Zf0i-r+qXqYf1aaa-f0.22X-Xf1a-f0.00987017Y-Yf4.43951nni-*f0.720955-Xf1.70145*f-1.06358-Yf3.14142i-*f1.14865-Xf0.637865*f1.34337-Yf3.86238-*f-1.86961-Xf1.98124*f-0.279789-Yf5.01103mnr+qXqZ__m-Xf-0-Yf0-Zf0i-r+qXqYf1aaa-f0.22X-Xf1a-f0.00987017Y-Yf4.43951nni-*f0.720955-Xf1.70145*f-1.06358-Yf3.14142i-*f1.14865-Xf0.637865*f1.34337-Yf3.86238-*f-1.86961-Xf1.98124*f-0.279789-Yf5.01103',float('-1.000000'),float('-1.000000'),float('-1.000000'),float('1.000000'),float('1.000000'),float('4.439515'))", "name": "rotated", "type": "_fabtypes.Shape", "uid": 5 } ], "inspector": [ 451.41755725203319, 121.81108687753277 ], "name": "r2", "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": 5 }, { "datums": [ { "expr": "-1.0805869698524475", "name": "x0", "type": "float", "uid": 0 }, { "expr": "0.17992857098579407", "name": "y0", "type": "float", "uid": 1 }, { "expr": "0.3724947001558493", "name": "r", "type": "float", "uid": 2 }, { "expr": "0.744423225968047", "name": "_a", "type": "float", "uid": 3 }, { "expr": "\u0012fab.types.Shape('-r+q-Xf-1.08059q-Yf0.179929f0.372495',float('-1.453082'),float('-0.192566'),float('-inf'),float('-0.708092'),float('0.552423'),float('inf'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 4 } ], "inspector": [ 278.39386305400626, 527.82079160087801 ], "name": "c1", "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": 6 }, { "datums": [ { "expr": "\u0011[__6.__4]", "name": "shape", "type": "_fabtypes.Shape", "uid": 0 }, { "expr": "0.0", "name": "x", "type": "float", "uid": 1 }, { "expr": "0.0", "name": "y", "type": "float", "uid": 2 }, { "expr": "6", "name": "n", "type": "int", "uid": 3 }, { "expr": "\u0012fab.types.Shape('iiiiim-Xf0-Yf0-Zf0m+*f1X*f0Y+*f-0X*f1Y_m-Xf-0-Yf-0-Zf0-r+q-Xf-1.08059q-Yf0.179929f0.372495m-Xf0-Yf0-Zf0m+*f0.5X*f0.866025Y+*f-0.866025X*f0.5Y_m-Xf-0-Yf-0-Zf0-r+q-Xf-1.08059q-Yf0.179929f0.372495m-Xf0-Yf0-Zf0m+*f-0.5X*f0.866025Y+*f-0.866025X*f-0.5Y_m-Xf-0-Yf-0-Zf0-r+q-Xf-1.08059q-Yf0.179929f0.372495m-Xf0-Yf0-Zf0m+*f-1X*f1.22465e-16Y+*f-1.22465e-16X*f-1Y_m-Xf-0-Yf-0-Zf0-r+q-Xf-1.08059q-Yf0.179929f0.372495m-Xf0-Yf0-Zf0m+*f-0.5X*f-0.866025Y+*f0.866025X*f-0.5Y_m-Xf-0-Yf-0-Zf0-r+q-Xf-1.08059q-Yf0.179929f0.372495m-Xf0-Yf0-Zf0m+*f0.5X*f-0.866025Y+*f0.866025X*f0.5Y_m-Xf-0-Yf-0-Zf0-r+q-Xf-1.08059q-Yf0.179929f0.372495',float('-1.453082'),float('-1.534617'),float('-inf'),float('1.453082'),float('1.534617'),float('inf'))", "name": "array", "type": "_fabtypes.Shape", "uid": 4 } ], "inspector": [ 664.874002934293, 511.1041549049487 ], "name": "a0", "script": [ "import fab", "import math", "", "title('Array (polar)')", "", "input('shape', fab.types.Shape)", "input('x', float)", "input('y', float)", "input('n', int)", "", "output('array', fab.shapes.iterate_polar(shape, x, y, n))", "", "# UI", "sb.ui.wireframe([", " (math.cos(i/36. * 2*math.pi) * 0.3 + x,", " math.sin(i/36. * 2*math.pi) * 0.3 + y, 0)", " for i in range(36)], close=True, color=sb.color.teal)", "", "sb.ui.point(x, y, 0, color=sb.color.teal)", "" ], "uid": 7 }, { "datums": [ { "expr": "-0.7198135256767273", "name": "_x", "type": "float", "uid": 0 }, { "expr": "1.0191826224327087", "name": "_y", "type": "float", "uid": 1 }, { "expr": "-1.057675658725202", "name": "zmin", "type": "float", "uid": 2 }, { "expr": "3.431483656167984", "name": "zmax", "type": "float", "uid": 3 }, { "expr": "\u0011[__7.__4]", "name": "shape", "type": "_fabtypes.Shape", "uid": 4 }, { "expr": "\u0012fab.types.Shape('am__f1iiiiim-Xf0-Yf0-Zf0m+*f1X*f0Y+*f-0X*f1Y_m-Xf-0-Yf-0-Zf0-r+q-Xf-1.08059q-Yf0.179929f0.372495m-Xf0-Yf0-Zf0m+*f0.5X*f0.866025Y+*f-0.866025X*f0.5Y_m-Xf-0-Yf-0-Zf0-r+q-Xf-1.08059q-Yf0.179929f0.372495m-Xf0-Yf0-Zf0m+*f-0.5X*f0.866025Y+*f-0.866025X*f-0.5Y_m-Xf-0-Yf-0-Zf0-r+q-Xf-1.08059q-Yf0.179929f0.372495m-Xf0-Yf0-Zf0m+*f-1X*f1.22465e-16Y+*f-1.22465e-16X*f-1Y_m-Xf-0-Yf-0-Zf0-r+q-Xf-1.08059q-Yf0.179929f0.372495m-Xf0-Yf0-Zf0m+*f-0.5X*f-0.866025Y+*f0.866025X*f-0.5Y_m-Xf-0-Yf-0-Zf0-r+q-Xf-1.08059q-Yf0.179929f0.372495m-Xf0-Yf0-Zf0m+*f0.5X*f-0.866025Y+*f0.866025X*f0.5Y_m-Xf-0-Yf-0-Zf0-r+q-Xf-1.08059q-Yf0.179929f0.372495a-f-1.05768Z-Zf3.43148',float('-1.453082'),float('-1.534617'),float('-1.057676'),float('1.453082'),float('1.534617'),float('3.431484'))", "name": "out", "type": "_fabtypes.Shape", "uid": 5 } ], "inspector": [ 1001.8649359283869, 511.86190362886674 ], "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": 8 }, { "datums": [ { "expr": "\u0011[__5.__5]", "name": "a", "type": "_fabtypes.Shape", "uid": 0 }, { "expr": "\u0011[__8.__5]", "name": "b", "type": "_fabtypes.Shape", "uid": 1 }, { "expr": "\u0012fab.types.Shape('am-Xf0-Yf0-Zf0m_+*f6.12323e-17Y*f1Z+*f-1Y*f6.12323e-17Zm-Xf0-Yf-0-Zf-0m-Xf0-Yf0-Zf0imr+qXqZ__m-Xf-0-Yf0-Zf0i-r+qXqYf1aaa-f0.22X-Xf1a-f0.00987017Y-Yf4.43951nni-*f0.720955-Xf1.70145*f-1.06358-Yf3.14142i-*f1.14865-Xf0.637865*f1.34337-Yf3.86238-*f-1.86961-Xf1.98124*f-0.279789-Yf5.01103mnr+qXqZ__m-Xf-0-Yf0-Zf0i-r+qXqYf1aaa-f0.22X-Xf1a-f0.00987017Y-Yf4.43951nni-*f0.720955-Xf1.70145*f-1.06358-Yf3.14142i-*f1.14865-Xf0.637865*f1.34337-Yf3.86238-*f-1.86961-Xf1.98124*f-0.279789-Yf5.01103nam__f1iiiiim-Xf0-Yf0-Zf0m+*f1X*f0Y+*f-0X*f1Y_m-Xf-0-Yf-0-Zf0-r+q-Xf-1.08059q-Yf0.179929f0.372495m-Xf0-Yf0-Zf0m+*f0.5X*f0.866025Y+*f-0.866025X*f0.5Y_m-Xf-0-Yf-0-Zf0-r+q-Xf-1.08059q-Yf0.179929f0.372495m-Xf0-Yf0-Zf0m+*f-0.5X*f0.866025Y+*f-0.866025X*f-0.5Y_m-Xf-0-Yf-0-Zf0-r+q-Xf-1.08059q-Yf0.179929f0.372495m-Xf0-Yf0-Zf0m+*f-1X*f1.22465e-16Y+*f-1.22465e-16X*f-1Y_m-Xf-0-Yf-0-Zf0-r+q-Xf-1.08059q-Yf0.179929f0.372495m-Xf0-Yf0-Zf0m+*f-0.5X*f-0.866025Y+*f0.866025X*f-0.5Y_m-Xf-0-Yf-0-Zf0-r+q-Xf-1.08059q-Yf0.179929f0.372495m-Xf0-Yf0-Zf0m+*f0.5X*f-0.866025Y+*f0.866025X*f0.5Y_m-Xf-0-Yf-0-Zf0-r+q-Xf-1.08059q-Yf0.179929f0.372495a-f-1.05768Z-Zf3.43148',float('-1.000000'),float('-1.000000'),float('-1.000000'),float('1.000000'),float('1.000000'),float('4.439515'))", "name": "shape", "type": "_fabtypes.Shape", "uid": 2 } ], "inspector": [ 1034.6532429224069, 167.58468019165747 ], "name": "Handle", "script": [ "import fab.types", "", "title('Difference')", "input('a', fab.types.Shape)", "input('b', fab.types.Shape)", "", "output('shape', a & ~b)", "" ], "uid": 9 }, { "datums": [ { "expr": "\u0011[__9.__2]", "name": "shape", "type": "_fabtypes.Shape", "uid": 0 }, { "expr": "\u0012fab.types.Shape('am-Xf0-Yf0-Zf0m_+*f6.12323e-17Y*f1Z+*f-1Y*f6.12323e-17Zm-Xf0-Yf-0-Zf-0m-Xf0-Yf0-Zf0imr+qXqZ__m-Xf-0-Yf0-Zf0i-r+qXqYf1aaa-f0.22X-Xf1a-f0.00987017Y-Yf4.43951nni-*f0.720955-Xf1.70145*f-1.06358-Yf3.14142i-*f1.14865-Xf0.637865*f1.34337-Yf3.86238-*f-1.86961-Xf1.98124*f-0.279789-Yf5.01103mnr+qXqZ__m-Xf-0-Yf0-Zf0i-r+qXqYf1aaa-f0.22X-Xf1a-f0.00987017Y-Yf4.43951nni-*f0.720955-Xf1.70145*f-1.06358-Yf3.14142i-*f1.14865-Xf0.637865*f1.34337-Yf3.86238-*f-1.86961-Xf1.98124*f-0.279789-Yf5.01103nam__f1iiiiim-Xf0-Yf0-Zf0m+*f1X*f0Y+*f-0X*f1Y_m-Xf-0-Yf-0-Zf0-r+q-Xf-1.08059q-Yf0.179929f0.372495m-Xf0-Yf0-Zf0m+*f0.5X*f0.866025Y+*f-0.866025X*f0.5Y_m-Xf-0-Yf-0-Zf0-r+q-Xf-1.08059q-Yf0.179929f0.372495m-Xf0-Yf0-Zf0m+*f-0.5X*f0.866025Y+*f-0.866025X*f-0.5Y_m-Xf-0-Yf-0-Zf0-r+q-Xf-1.08059q-Yf0.179929f0.372495m-Xf0-Yf0-Zf0m+*f-1X*f1.22465e-16Y+*f-1.22465e-16X*f-1Y_m-Xf-0-Yf-0-Zf0-r+q-Xf-1.08059q-Yf0.179929f0.372495m-Xf0-Yf0-Zf0m+*f-0.5X*f-0.866025Y+*f0.866025X*f-0.5Y_m-Xf-0-Yf-0-Zf0-r+q-Xf-1.08059q-Yf0.179929f0.372495m-Xf0-Yf0-Zf0m+*f0.5X*f-0.866025Y+*f0.866025X*f0.5Y_m-Xf-0-Yf-0-Zf0-r+q-Xf-1.08059q-Yf0.179929f0.372495a-f-1.05768Z-Zf3.43148',float('-1.000000'),float('-1.000000'),float('-1.000000'),float('1.000000'),float('1.000000'),float('4.439515'))", "name": "out", "type": "_fabtypes.Shape", "uid": 1 } ], "inspector": [ 1448.8834050391022, 203.38363325393607 ], "name": "m0", "script": [ "import fab", "", "title('Mesh (.stl)')", "", "input('shape', fab.types.Shape)", "output('out', shape)", "", "sb.export.stl(shape)", "" ], "uid": 10 } ], "protocol": 6, "type": "sb" }