diff --git a/surfaces/blender/docs/kitbash.md b/surfaces/blender/docs/kitbash.md index 1c7f452..586b9ab 100644 --- a/surfaces/blender/docs/kitbash.md +++ b/surfaces/blender/docs/kitbash.md @@ -76,7 +76,8 @@ then y, then z, about the shape's own origin) place it, rotation first; both def | `tube` | `r0`, `r1`, `length`, `segments`, `inner0`?, `inner1`?, `smooth`? | A frustum on +z from radius `r0` at z=0 to `r1` at z=`length`, with n-gon caps. Inner radii above 0 make it hollow (an inner wall and two flat end rings); they are both above 0 or both 0, and below the outer radius. `segments` is 3 to 128. `smooth` shades the walls smooth; caps stay flat. | | `box` | `size` | A box centred on its origin; every size above 0. | | `lathe` | `profile`, `segments`, `loop`?, `smooth`? | A profile of `[r, z]` points revolved about +z into one shell, a ring of `segments` (3 to 128) vertices per point. An open profile's end on the axis (`r` exactly 0) is a pole; an end off the axis gets a flat n-gon cap. With `loop` true the last point joins the first and there are no caps (a ring: 3 points or more). `smooth` shades the walls smooth; a band between two points of one `z` (an annulus) and the caps stay flat. A point written `[r, z, "sharp"]` is a crease. | -| `repeat` | `count`, `of`, and `step` or `around` with `center`? | `count` copies (1 to 256) of one tube, box or lathe: at `k * step`, k from 0, or turned `k * 360 / count` degrees, right-handed, about the axis `around` (one of `+x -x +y -y +z -z`) through `center` (default the origin). Exactly one of `step` and `around`. A repeat cannot hold a repeat. | +| `extrude` | `section`, `w`, `h`, `t`, `path`, `up`, `loop`? | A section (`I`, `C`, `T`, `L`, `box`, `wedge` or `gusset`: a name, never an expression) of width `w`, height `h` and wall `t`, swept along `path`, 2 to 64 `[x, y, z]` points, into one shell with a flat cap at each end. `up` is one `[x, y, z]` vector the section's height stands along. With `loop` true the last point joins the first and there are no caps (3 points or more). Every face is flat. | +| `repeat` | `count`, `of`, and `step` or `around` with `center`? | `count` copies (1 to 256) of one tube, box, lathe or extrude: at `k * step`, k from 0, or turned `k * 360 / count` degrees, right-handed, about the axis `around` (one of `+x -x +y -y +z -z`) through `center` (default the origin). Exactly one of `step` and `around`. A repeat cannot hold a repeat. | A lathe's profile is listed out along the bottom and up the outside, as this flanged stub is: a cap of radius 0.1 at z=0, the flange's rim, its top face, the pipe, and a cap of radius 0.05 at z=0.3. @@ -109,6 +110,31 @@ refused at an open profile's two ends, which are a cap or a pole. No modifier or Shells may overlap (a pad that runs into a tank), and a part is then not one solid: reports give the shell count. +An extrude stands its section on the path by one rule (`core.sweep`, which also makes a rib's longerons). At each +path point the section lies in the plane that bisects the turn there. Its y axis is `up` with the path's direction +taken out of it, and its x axis is that y cross the path's direction: along +z with `up` +y the section's x is +x +and its y is +y, as drawn; along +x with `up` +z its x is +y. A corner is mitred: the section is stretched in the +plane of the turn by 1 / cos(half the turn), so it keeps its size on both sides of the corner. `at` and `rot` then +place the whole shell as they place any shape. + +| section | outline, counter-clockwise in (x, y), centred on its `w` by `h` box | `t` | `t` must be under | +| --- | --- | --- | --- | +| `I` | two flanges across x joined by a web along y | flange and web thickness | `w` and `h / 2` | +| `C` | the web on -x, two flanges opening toward +x | flange and web thickness | `w` and `h / 2` | +| `T` | the flange across x at +y, the stem down the middle | flange and stem thickness | `w` and `h` | +| `L` | one leg along x at -y, one along y at -x | leg thickness | `w` and `h` | +| `box` | the solid `w` by `h` rectangle | unused, but above 0 | | +| `wedge` | a right trapezoid: base `w` at -y, its back `h` tall at -x, its front `t` tall at +x | front height | `h` | +| `gusset` | a right triangle on legs `w` (along x at -y) and `h` (along y at -x), each acute tip cut square | length of the flat that cuts a tip | half the shorter leg | + +Every size is above 0. A build is refused, naming the kit, part and shape, when the section has no room for its +wall, when `up` runs along the path at a point (or is zero), when two path points are closer than 1e-9, when the +path turns more than 150 degrees at a point (past it a mitre runs 3.9 times the section's width), and when the +section folds: the path turns tighter than the section reaches on the inside of the turn. One `up` serves the +whole path, so a path that bends in two planes needs an `up` that crosses every segment and every corner's +bisector; a portal in the xz plane takes `up` +y, which stands an I section's web across the frame's plane. +`smooth` is not a field of an extrude: a section's faces are flat, and its corners take the part's `bevel`. + **`bevel`** is the width of a Bevel modifier `place_part` adds (2 segments, edges sharper than 30 degrees). Keep it well under the part's thinnest feature at its smallest params. @@ -500,7 +526,7 @@ takes planes in the cage's own frame and makes, as one mesh object under the cag - longerons through the ribs: each `{origin, axis, toward}` is the half-plane from the line through `origin` along `axis`, on `toward`'s side. Where it crosses a plane's rib, at the rib's mid-depth, is a station; the longeron runs through the stations in the planes' order and 0.12 of the end gaps past the end ribs, a section - `longeron` (`I`, `C`, `T`, `L` or `box`; `longeron_w`, `longeron_h`, `longeron_t`) with its up toward the plate. + `longeron` (a section of the extrude shape's table: `I`, `C`, `T`, `L`, `box`, `wedge` or `gusset`; `longeron_w`, `longeron_h`, `longeron_t`) with its up toward the plate. A rib's outer edge is where its plane cuts the offset surface (`core.inset` makes it: each vertex of the inner face stepped to where its faces, moved in by `standoff`, meet). Points `step` apart along the section each look @@ -693,6 +719,26 @@ the tank's axis. The bracket's `pivot` face lies on its plate's centre plane, so the same side, turned half (roll 180), pins on the same plane facing the first. An actuator on one and a strut on the other then lie in one plane and can meet at a pin: a braced leg. +## The frame kit + +`kits/frame.v0.json`: nine parts of chassis structure, every shell an extrude. Its socket types are `mount` (fits) +and `pivot` (equal), the same two lines as `mechanical`'s, so a frame part seats on a mechanical one and the other +way round (`place_part` and `describe` take `kit: "frame"`). + +| part | params | what it is | sockets | +| --- | --- | --- | --- | +| `beam_i`, `channel`, `tee`, `angle` | `length`, `w`, `h`, `t` | An I, C, T or L section along +z from 0 to `length`, `w` across x and `h` along y. `t` is held under 0.45 of the smaller of `w` and `h`. | `end_a` (z -z) and `end_b` (z +z), `mount`, size the smaller of `w` and `h`. On a channel and an angle they sit on the web at -x, where the end face is. | +| `box_beam` | `length`, `w`, `h` | A solid rectangular bar along +z. | `end_a`, `end_b`, as a beam's | +| `truss` | `length`, `height`, `pairs`, `chord`, `web` | A plane truss along +x in the xz plane: two square chords at z 0 and z `height`, `2*pairs + 1` verticals and `2*pairs` diagonals, rising then falling: `4*pairs + 3` shells. Bays come in pairs (1 to 16) because an expression has no floor: the diagonals are two repeats a double bay apart. | `end_a` (z -x) and `end_b` (z +x) on the end verticals at mid-height, `mount`, size `height` | +| `portal` | `width`, `height`, `w`, `h`, `t` | One I section up a leg, across and down the other in the xz plane, mitred at both corners; its flanges face +y and -y. | `foot_a`, `foot_b` (z -z), `mount` | +| `gusset` | `w`, `h`, `t`, `thickness` | A corner plate in the xy plane with its right angle at the origin, legs along +x and +y, `thickness` along +z. | `leg_a` on the x leg's edge (z -y) and `leg_b` on the y leg's (z -x), `mount`, size `thickness` | +| `wedge` | `length`, `w`, `h`, `t` | A toe cap, ramp or chock along +x: base on z 0, back `h` tall at -y, sloping to a front `t` tall at +y (`t` held under 0.9 of `h`). | `base` (z -z) and `back` (z -y), `mount` | + +No frame part has a bevel. `core.build` costs, as medians of 21 interleaved builds on the workstation beside the +mechanical actuator's 2.3 ms: a beam, the portal, the gusset or the wedge 0.7 to 0.9 ms; the truss 2.8 ms at +`pairs` 4 (19 shells) and 3.8 ms at `pairs` 16 (67 shells). A repeat sweeps its one shape once and copies it, so +a truss costs four sweeps whatever its bays; the same 19 and 67 shells swept one by one measured 5.9 ms and 20.7 ms. + ## Adding a part or a kit Edit the kit's JSON (or add `kits/.v0.json`, whose `kit` field is ``), then run the tests: @@ -706,10 +752,13 @@ python -m unittest discover -s surfaces/blender/tests -p "test_kitbash.py" -v seated on a face that faces its `z`, and no build passes 20000 faces. Choose param ranges so every combination builds: a `min` or `max` in an expression keeps a derived length positive where two params could cross. A new part of `mechanical` also joins the part and socket list in `test_the_kit_is_the_eleven_parts_and_three_socket_types`. -`CuttersKitTests` holds `cutters` to the same, with each floor on its cutter's bottom, and `SurfaceFrameTests` the +`FrameKitTests` holds `frame` to the same (its seat check reads a section's cap, which is not convex, by the +face's own normal and outline), with the truss's shells, the portal's mitres and a beam seated on a mechanical +bracket. `CuttersKitTests` holds `cutters` to the same, with each floor on its cutter's bottom, and `SurfaceFrameTests` the frame `cut` gives a cutter. `MateTests` covers the mate arithmetic and what may mate, within a kit and across two, `PoseTests` the closed-form rolls. The operators are exercised in a real Blender by -`tests/live/kitbash.py` (placing and re-parameterising), `tests/live/kitbash_assembly.py` (attach, detach, +`tests/live/kitbash.py` (placing and re-parameterising, and the frame kit: its nine parts placed, the truss +re-parameterised, a beam seated on a bracket), `tests/live/kitbash_assembly.py` (attach, detach, `set_params` on assemblies, a braced leg closed by `close`, boolean and apply), `tests/live/kitbash_shell.py` (`cut` and `cut_many` on a cage that is not a kit part, a part on a cutter's floor, the three Boolean modifiers, an object in no collection) and `tests/live/kitbash_pose.py` (roll, aim and reach).