[{"data":1,"prerenderedAt":175},["ShallowReactive",2],{"site-chrome":3,"i-lucide:sparkles":70,"i-lucide:pencil-ruler":74,"cms-page:\u002Fdocs\u002Fscript-parts":76,"i-lucide:arrow-right":171,"i-lucide:layout-grid":173},{"nav":4,"footer":25},{"id":5,"brand":6,"links":7},1,"CubbyCAD",[8,13,17,22],{"id":5,"sort":5,"label":9,"href":10,"external":11,"visibility":12},"Home","\u002F",0,"always",{"id":14,"sort":14,"label":15,"href":16,"external":11,"visibility":12},2,"Explore","\u002Fexplore",{"id":18,"sort":19,"label":20,"href":21,"external":11,"visibility":12},5,4,"Docs","\u002Fdocs",{"id":19,"sort":18,"label":23,"href":24,"external":11,"visibility":12},"Enhanced Plan","\u002Fpricing",{"id":5,"tagline":26,"version_label":27,"links":28},"A browser-based 3D modeler for designing parts you can actually print.","v0.1",[29,34,37,40,43,47,52,59,65],{"id":5,"sort":30,"group":31,"label":32,"href":33,"external":5,"visibility":12},10,"Use","Open the editor","\u002Feditor\u002F",{"id":14,"sort":35,"group":31,"label":36,"href":16,"external":11,"visibility":12},11,"Explore parts & workspaces",{"id":38,"sort":39,"group":31,"label":20,"href":21,"external":11,"visibility":12},3,12,{"id":19,"sort":41,"group":31,"label":42,"href":24,"external":11,"visibility":12},13,"Pricing",{"id":18,"sort":44,"group":31,"label":45,"href":46,"external":5,"visibility":12},14,"Slicer","\u002Fslicer\u002F",{"id":48,"sort":49,"group":31,"label":50,"href":51,"external":11,"visibility":12},6,15,"Credits","\u002Fcredits",{"id":53,"sort":54,"group":55,"label":56,"href":57,"external":11,"visibility":58},7,20,"Account","Your workspaces","\u002Faccount","signed-in",{"id":60,"sort":61,"group":55,"label":62,"href":63,"external":11,"visibility":64},8,21,"Sign in","\u002Flogin","signed-out",{"id":66,"sort":67,"group":55,"label":68,"href":69,"external":11,"visibility":64},9,22,"Make an account","\u002Fsignup",{"left":11,"top":11,"width":71,"height":71,"rotate":11,"vFlip":72,"hFlip":72,"body":73},24,false,"\u003Cg fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\">\u003Cpath d=\"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594zM20 2v4m2-2h-4\"\u002F>\u003Ccircle cx=\"4\" cy=\"20\" r=\"2\"\u002F>\u003C\u002Fg>",{"left":11,"top":11,"width":71,"height":71,"rotate":11,"vFlip":72,"hFlip":72,"body":75},"\u003Cpath fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M13 7L8.7 2.7a2.41 2.41 0 0 0-3.4 0L2.7 5.3a2.41 2.41 0 0 0 0 3.4L7 13m1-7l2-2m8 12l2-2m-3-3l4.3 4.3c.94.94.94 2.46 0 3.4l-2.6 2.6c-.94.94-2.46.94-3.4 0L11 17M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497zM15 5l4 4\"\u002F>",{"id":30,"title":77,"permalink":78,"status":79,"meta_title":80,"meta_description":81,"og_image":82,"blocks":83},"Script parts","\u002Fdocs\u002Fscript-parts","published","Script parts · CubbyCAD docs","Write a part in JavaScript or TypeScript; the numbers and toggles you expose become editable settings.",null,[84,92,99,108,149,155],{"id":85,"sort":14,"collection":86,"item":87},45,"block_hero",{"id":30,"eyebrow":88,"headline":77,"subhead":81,"figure":89,"note":82,"tone":90,"buttons":91},"You know you want to use them","","mint",[],{"id":93,"sort":19,"collection":94,"item":95},46,"block_richtext",{"id":61,"eyebrow":82,"heading":82,"body":96,"align":97,"variant":98,"tone":98},"\u003Cp>A \u003Cstrong>script part\u003C\u002Fstrong> is a part you build with code instead of by dragging shapes. You write a short ManifoldCAD-style ES module that returns a solid, and CubbyCAD runs it to produce real geometry. Any parameters you declare — sizes, counts, angles, on\u002Foff toggles — show up as ordinary sliders, number fields, and switches, so you (or anyone who uses your part) can dial it in without touching the code.\u003C\u002Fp>\n\u003Cp>Reach for a script part when a shape is fundamentally parametric or repetitive: gears, lattices, pegboard\u002FGridfinity-style grids, threads, or anything you'd rather express as a loop and a formula than place by hand. Because the part stays live, changing a parameter rebuilds the geometry instantly.\u003C\u002Fp>","left","default",{"id":100,"sort":18,"collection":101,"item":102},90,"block_media",{"id":103,"image":104,"image_path":82,"alt":105,"caption":106,"heading":82,"body":82,"layout":107,"tone":98,"video":82,"video_path":82},17,"fe5e6220-7d0e-485c-a44d-610cc460437b","Script parts: the code editor with live preview","**Overview.** A script part with its code, parameters, and live preview.","full",{"id":109,"sort":48,"collection":110,"item":111},47,"block_steps",{"id":48,"eyebrow":82,"heading":112,"intro":82,"tone":113,"image":114,"image_path":82,"video":82,"video_path":82,"alt":115,"caption":116,"items":117},"How to use it","sky","f3955d37-586b-4cf6-98d0-8151229c9a67","Parameters becoming editable sliders","**In the editor.** Declared parameters surfaced as sliders on the placed part.",[118,122,125,129,133,137,141,145],{"id":119,"block_steps":48,"sort":5,"title":120,"body":121},35,"Create the part","\u003Cp>Open the \u003Cstrong>Parts\u003C\u002Fstrong> panel and click the \u003Cstrong>New script part\u003C\u002Fstrong> tile (you can also run \u003Cspan class=\"menu\">File ▸ New script part…\u003C\u002Fspan> from the File menu or command palette). Give the part a name and click \u003Cstrong>Create\u003C\u002Fstrong>.\u003C\u002Fp>",{"id":123,"block_steps":48,"sort":14,"title":32,"body":124},36,"\u003Cp>The script editor opens as a docked panel. The left side holds the part's \u003Cstrong>Label\u003C\u002Fstrong>, \u003Cstrong>Icon\u003C\u002Fstrong>, \u003Cstrong>Shape ID\u003C\u002Fstrong>, \u003Cstrong>Description\u003C\u002Fstrong>, \u003Cstrong>Tags\u003C\u002Fstrong>, and a \u003Cstrong>Parameters\u003C\u002Fstrong> list. The right side is the code editor with a \u003Cstrong>Live preview\u003C\u002Fstrong> underneath.\u003C\u002Fp>",{"id":126,"block_steps":48,"sort":38,"title":127,"body":128},37,"Start from an example","\u003Cp>To start from something that already works, switch to the \u003Cstrong>Examples\u003C\u002Fstrong> tab and pick a template (Centered cube, Rounded box, Polygon prism, Revolved vase, Pegboard tile, Spur gear, Gridfinity bin, and more).\u003C\u002Fp>",{"id":130,"block_steps":48,"sort":19,"title":131,"body":132},38,"Write the module","\u003Cp>Write your module in the editor. Import the geometry API and your parameters, then \u003Ccode>export default\u003C\u002Fcode> a solid. For example:\u003C\u002Fp>\n\u003Cp>\u003Ccode>import { Manifold } from 'manifold-3d\u002FmanifoldCAD';\u003Cbr>import params from 'cubbycad:params';\u003Cbr>const size = Number(params.size) || 10;\u003Cbr>export default Manifold.cube([size, size, size], true);\u003C\u002Fcode>\u003C\u002Fp>",{"id":134,"block_steps":48,"sort":18,"title":135,"body":136},39,"Define parameters","\u003Cp>Define your editable settings under \u003Cstrong>Parameters\u003C\u002Fstrong>: click \u003Cstrong>Add parameter\u003C\u002Fstrong> and fill in a \u003Cstrong>Key\u003C\u002Fstrong> (e.g. \u003Ccode>radius\u003C\u002Fcode>), a \u003Cstrong>Label\u003C\u002Fstrong>, a \u003Cstrong>Type\u003C\u002Fstrong> (Number, Integer, String, Boolean, or Enum), and a \u003Cstrong>Default\u003C\u002Fstrong>. Numeric types also take \u003Cstrong>Min\u003C\u002Fstrong>, \u003Cstrong>Max\u003C\u002Fstrong>, \u003Cstrong>Step\u003C\u002Fstrong>, and \u003Cstrong>Unit\u003C\u002Fstrong>. Read each value in code via \u003Ccode>params.&lt;key&gt;\u003C\u002Fcode>.\u003C\u002Fp>",{"id":138,"block_steps":48,"sort":48,"title":139,"body":140},40,"Watch the preview","\u003Cp>Watch the \u003Cstrong>Live preview\u003C\u002Fstrong> as you edit — it shows \u003Cstrong>building…\u003C\u002Fstrong> then \u003Cstrong>ready\u003C\u002Fstrong>, and prints any build or validation errors in red.\u003C\u002Fp>",{"id":142,"block_steps":48,"sort":53,"title":143,"body":144},41,"Save the part","\u003Cp>Click \u003Cstrong>Create script\u003C\u002Fstrong> (or \u003Cstrong>Save changes\u003C\u002Fstrong> when editing) to save the part to your workspace. Click \u003Cstrong>Close\u003C\u002Fstrong> to leave the editor.\u003C\u002Fp>",{"id":146,"block_steps":48,"sort":60,"title":147,"body":148},42,"Place an instance","\u003Cp>Back in the scene, drag the part's tile from the Parts panel into the viewport to place an instance. Select the instance to adjust its parameters in the properties panel.\u003C\u002Fp>",{"id":150,"sort":60,"collection":94,"item":151},48,{"id":152,"eyebrow":82,"heading":153,"body":154,"align":97,"variant":98,"tone":90},23,"Tips","\u003Cul>\n\u003Cli>Scripts use the same dialect as manifoldcad.org, so scripts written there usually paste in with little or no change. Build with \u003Ccode>Manifold\u003C\u002Fcode> for 3D primitives and booleans (\u003Ccode>subtract\u003C\u002Fcode>, \u003Ccode>add\u003C\u002Fcode>, \u003Ccode>hull\u003C\u002Fcode>), and \u003Ccode>CrossSection\u003C\u002Fcode> for 2D profiles you \u003Ccode>extrude\u003C\u002Fcode> or \u003Ccode>revolve\u003C\u002Fcode>.\u003C\u002Fli>\n\u003Cli>You can \u003Ccode>export default\u003C\u002Fcode> a single solid \u003Cstrong>or an array of solids\u003C\u002Fstrong> — an array is merged with a boolean union, handy for building assemblies in a loop.\u003C\u002Fli>\n\u003Cli>TypeScript is fine: type annotations are stripped before the script runs. Top-level \u003Ccode>await\u003C\u002Fcode> is allowed too.\u003C\u002Fli>\n\u003Cli>Only two imports are permitted — \u003Ccode>manifold-3d\u002FmanifoldCAD\u003C\u002Fcode> and \u003Ccode>cubbycad:params\u003C\u002Fcode>. Any other import is a hard error, and only \u003Ccode>export default\u003C\u002Fcode> is recognized. Scripts run in a locked-down sandbox with no network or DOM access.\u003C\u002Fli>\n\u003Cli>Guard your parameter reads with a fallback (\u003Ccode>Number(params.size) || 10\u003C\u002Fcode>) so a blank or out-of-range value never breaks the build.\u003C\u002Fli>\n\u003Cli>The \u003Cstrong>Shape ID\u003C\u002Fstrong> is locked after the first save so existing scenes keep resolving the part — choose it deliberately.\u003C\u002Fli>\n\u003C\u002Ful>",{"id":156,"sort":30,"collection":157,"item":158},49,"block_cta",{"id":66,"heading":159,"body":160,"note":82,"align":161,"tone":162,"buttons":163},"Try it in your browser","Open CubbyCAD and put Script parts to work — it runs in the browser, no install.","center","lilac",[164,167],{"id":61,"sort":5,"block_cta":66,"block_hero":82,"label":32,"href":33,"icon":165,"trailing":5,"external":11,"variant":166},"i-lucide-arrow-right","primary",{"id":67,"sort":14,"block_cta":66,"block_hero":82,"label":168,"href":21,"icon":169,"trailing":11,"external":11,"variant":170},"Browse guides","i-lucide-layout-grid","outline",{"left":11,"top":11,"width":71,"height":71,"rotate":11,"vFlip":72,"hFlip":72,"body":172},"\u003Cpath fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M5 12h14m-7-7l7 7l-7 7\"\u002F>",{"left":11,"top":11,"width":71,"height":71,"rotate":11,"vFlip":72,"hFlip":72,"body":174},"\u003Cg fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\">\u003Crect width=\"7\" height=\"7\" x=\"3\" y=\"3\" rx=\"1\"\u002F>\u003Crect width=\"7\" height=\"7\" x=\"14\" y=\"3\" rx=\"1\"\u002F>\u003Crect width=\"7\" height=\"7\" x=\"14\" y=\"14\" rx=\"1\"\u002F>\u003Crect width=\"7\" height=\"7\" x=\"3\" y=\"14\" rx=\"1\"\u002F>\u003C\u002Fg>",1782830974031]