Function Reference: solid.sweep

drafting: S = solid.sweep (R, P)

A solid swept by a region along a path.

S = solid.sweep (R, P) returns a solid.Shape traced by the geom.Region R as it travels along the geom.Path P. This is how a bent bar, a frame of welded sections or a pipe run is modelled; a hole in the region makes a tube.

Along an arc or a spline of the path the solid bends smoothly. Where two segments meet at an angle the solid keeps a sharp corner, mitred as two sawn lengths are joined; round such a corner with geom.Path.fillet for a bend. A spline joined into a path meets its neighbours smoothly unless told not to, see geom.Path.join. The path must not turn straight back on itself. A closed path makes a ring.

The region is swept from where it lies. Normally its plane passes through the first point of the path, square to the path there; a region in the default xy plane is swept as drawn along a path that starts at the origin and runs up the z axis. A region placed elsewhere is swept beside the path, keeping its distance, as a rail follows a centre line:

 
 ## A tube of 2 bore and 0.5 wall, bent twice with bends of radius 5
 R = geom.Region ([1.5, 0, 1; -1.5, 0, 1], {[1, 0, 1; -1, 0, 1]});
 P = geom.Path ([0, 0, 0; 0, 0, 20; 20, 0, 20; 20, 20, 20]);
 S = solid.sweep (R, fillet (P, 5));

A section centred on the path keeps its area through every bend and every mitred corner, so its volume is its area times the length of the path. A section far off the path, or a bend or corner too tight for it, makes a solid that intersects itself; check such a result with solid.Shape.isvalid.

See also: geom.Path, geom.Spline, geom.Region, solid.extrude, solid.helix

Source Code: solid.sweep