millisketch

Add

Add a shape

add_body

Adds a box, sphere, cylinder, cone, torus, tube, wedge, rounded box, gear, ring gear, rack or nut.

EditorTools tabAgentMCP
Needs
Nothing to pick: it works on the whole document.
In the editor
3D, Object mode: Add on the toolbar, then a shape; it lands beside the bodies already there with its starting dimensions, which the Object tab retypes.
Tools tab
A form of its inputs, filled from what is picked; Run makes the change, one step to undo.
Agent and MCP
The chat's agent and MCP clients call add_body, each call one step to undo. Over MCP it also takes project, editor and request_id.

What it does

A primitive, a gear or a part, of a kind and its dimensions; a dimension left out keeps the kind's starting value, the Add menu's. Without a position the body lands on the ground beside the bodies already there; with one, the middle of its underside goes there, so z 0 stands it on the ground.

The kinds, each dimension with its key and starting value: Box (box): Width X (width) 20 mm, Depth Y (depth) 20 mm, Height Z (height) 20 mm. Sphere (sphere): Diameter (diameter) 20 mm. Cylinder (cylinder): Diameter (diameter) 20 mm, Height Z (height) 30 mm. Cone (cone): Base ⌀ (diameter) 20 mm, Top ⌀ (top) 0 mm, Height Z (height) 30 mm. Torus (torus): Ring ⌀ (diameter) 30 mm, Tube ⌀ (tube) 8 mm. Tube (tube): Outer ⌀ (diameter) 20 mm, Bore ⌀ (bore) 12 mm, Height Z (height) 30 mm. Wedge (wedge): Width X (width) 30 mm, Depth Y (depth) 20 mm, Height Z (height) 15 mm. Rounded box (roundedBox): Width X (width) 30 mm, Depth Y (depth) 20 mm, Height Z (height) 10 mm, Corner R (radius) 4 mm. Gear (gear): Module (module) 2 mm, Teeth (teeth) 18, Pressure ∠ (pressureAngle) 20 °, Thickness (thickness) 8 mm, Bore ⌀ (bore) 6 mm. Rack (rack): Module (module) 2 mm, Teeth (teeth) 8, Pressure ∠ (pressureAngle) 20 °, Thickness (thickness) 8 mm, Body (height) 6 mm. Ring gear (ringGear): Module (module) 2 mm, Teeth (teeth) 36, Pressure ∠ (pressureAngle) 20 °, Thickness (thickness) 8 mm, Rim (rim) 5 mm. Nut (nut): Across flats (size) 13 mm, Thickness (thickness) 6.5 mm, Bore ⌀ (bore) 8 mm.

Two spur gears mesh when they share a module and a pressure angle, stand at the same height, and their centres are module × (teethA + teethB) / 2 apart.

Inputs

As the agent and MCP clients send them. One left out takes the default its description gives.

InputTypeWhat it is
kindneededone of "box", "sphere", "cylinder", "cone", "torus", "tube", "wedge", "roundedBox", "gear", "rack", "ringGear", "nut"Kind.
dimensionsnumbers by keyThe kind's dimensions by key, as in the table of kinds.
position[x, y, z][x, y, z] in mm: where the middle of the body's underside goes, so z 0 stands it on the ground.
rotation[x, y, z][x, y, z] in degrees, applied in that order about the body's origin.
colorstring or null"#rrggbb"; null gives the default colour back.

Limits

  • A size that makes no solid is refused with the reason and nothing is added: a tube's bore must be smaller than its outer diameter, a rounded box's corner radius under half its shorter side, a gear's bore inside the roots of its teeth.
  • Gears have no undercut or profile shift, so a pinion of under 17 teeth at 20° binds near its root; no helical or bevel gears, no threads. A rounded box rounds its four upright edges alone.
  • An imported or an editable mesh cannot be added this way.

Examples

A 40 × 20 × 5 mm plate at the origin

Given: An empty document.

add_body { "kind": "box", "dimensions": { "width": 40, "depth": 20, "height": 5 }, "position": [0, 0, 0] }

Then: Box 1, 40 × 20 × 5 mm, standing on the ground with its underside centred on the origin.

A pinion meshing with an 18-tooth gear

Given: Gear 1, a spur gear of 18 teeth of module 2, at the origin.

add_body { "kind": "gear", "dimensions": { "module": 2, "teeth": 9 }, "position": [27, 0, 0] }

Then: Gear 2, 9 teeth of module 2, its centre 2 × (18 + 9) / 2 = 27 mm from Gear 1's: with an odd tooth count it needs no turn to mesh.