Tube
Status: Implemented

Tube builds a ball-and-stick pipe network: one body per selected edge, with a sphere unioned in at every junction where two or more segments meet.
Walkthrough

Recorded from the running app by BREP_mcp/tests/videos/tube.json; regenerate every walkthrough with ./build.sh docs-videos.
Inputs
path– multiplereference_selection(EDGE, defaultnull). Each edge becomes one tube segment, straight or curved; connected edges are joined with a sphere at every junction; disconnected groups become separate tubes.radius–number, default5. Outer radius of the tube; it must be positive.innerRadius–number, default0. Optional inner radius for a hollow tube;0makes it solid.bendRadius–number, default0. Round every corner where two straight edges meet into a bend of this radius, swept as one body;0joins them with a sphere instead. See Bends.boolean–boolean_operation, default operationNONEwith no targets and coplanar-face merging enabled. Optionally union, subtract, or intersect against selected solids.id–string, defaultnull. Optional identifier for the history entry.
Behaviour
- Each selected edge becomes its own body, following that edge from start vertex to end vertex at the tube radius: a cylinder for a straight edge, and for a curved one — an arc, a spline, a helix — a circle of the tube radius swept along the edge, as Path Sweep (SWP) does, at 32 stations. The curved surface is fitted at those stations; tighter bends and longer paths can have larger approximation error.
- Straight and curved segments mix freely in one path: a curved segment's end cap is the same disc a cylinder caps with, so the arms meet exactly.
- Edges are grouped into connected components by shared endpoints. Each component becomes one solid, and disconnected components become separate solids.
- At every junction node — anywhere two or more segments meet, from a simple corner to a four-way branch — a sphere is unioned in, filling and rounding the joint; it bridges any number of arms. It is inscribed — exactly the tube radius, so it never stands proud of the pipe — and builds at every slenderness measured (arm length 5 to 200 times the radius).
- An inscribed ball only shows where the arms leave a gap. At a corner, or at a branch whose arms all lean the same way, part of the ball survives and rounds the joint. Where the arms cover it — a T whose through-arms are collinear, a four-way star — it is buried whole and contributes no face at all, which is right for a ball that adds no material.
- A slightly wider ball is used only if the inscribed one cannot be built.
- Free ends (a node with one segment) keep a flat cap normal to the path tangent.
- A closed edge — a cylinder or cone rim, a full circle — has no ends to hang a segment between, so it is swept once round as a ring: one body with two side faces and no caps, a torus when the edge is a circle. A hollow ring is the outer ring minus the inner one. A ring is always its own body; it does not join the ball-and-stick assembly of any open edges selected with it.
Bends
Set bendRadius above zero and a corner where two straight edges meet stops being a joint and
becomes a real bend: the path is pulled back from the corner by bendRadius / tan(γ/2) on each
side, a tangent arc is laid across it, and the whole run of segments joined by such corners is
swept as one body. There is no sphere, no boolean and no bead at such a corner — a bend has no
crotch, so there is no tangency to bury and nothing protrudes. The wall is tangent-continuous
through the turn, and a hollow bend bores concentrically, so its wall is the same thickness round
the bend as along the straight.
The lane is chosen per corner, so bends and joint balls mix in one path: a branch where three or more segments meet has no single corner to round and keeps its ball, and so does a corner involving a curved segment.
- A bend is exact geometry, not an approximation. Each straight run is an extruded cylinder and each corner a revolved torus sector, joined by sewing their coincident rims rather than by a boolean — so every face keeps a real analytic surface and the volume matches the closed form to about 2e-11. What it costs is face count: a bend's walls come in halves, so a single elbow has eight faces where a plain corner has five.
- A closed loop keeps two joints. Opening a cycle takes two breaks, not one: with a single break the path still starts and ends at the same point. Two corners therefore keep their balls and every other corner bends.
- A bend that does not fit is refused, naming its numbers — a radius no larger than the tube radius (the section would sweep back through itself), or two setbacks that do not fit the edge between them.
- A tube along a solid edge follows that edge, not the whole curve the edge was cut from: an edge whose end was taken by a fillet or a boolean stops where the edge stops.
- A hollow tube is the whole network built at each radius, the inner subtracted from the outer per component. It supports connected paths, corners, branches, closed loops and disconnected components. A hollow curved edge bores concentrically, with annular caps. At junctions each radius gets its own joint ball, so wall thickness varies around a joint rather than following a constant-thickness offset.
Limitations
- A radius that folds the tube is refused. A tube of radius
rabout a curve is a solid only whilerstays under the curve's radius of curvature; at or past it the section sweeps back through material it already swept. The curvature is sampled at 128 stations along each curved edge and a radius that reaches it errors, naming both numbers. Sampling can under-estimate the curvature between stations, so this catches the fold you would see, not every conceivable one.