[OpenSCAD] bend a pipe/tube
Chow Loong Jin
hyperair at debian.org
Wed Apr 29 05:20:58 EDT 2015
On Wed, Apr 29, 2015 at 01:32:58AM -0700, biskero wrote:
> Ciao,
>
> thanks for the link.
> Any suggestions on which function would apply to my case?
> I am kind of new to openscad and it will help me a lot.
sweep(), basically. sweep() has this signature:
sweep(shape, path_transforms, closed=false);
shape is a list of 2D coordinates in a specific order. You can generate these by
using one of the functions in <scad-utils/shapes.scad>. These coordinates can also
be fed into polygon() to see what kind of shape you're getting.
path_transforms is a list of 4x4 matrix transformations that are applied using
multmatrix. Again, you can generate these individual transformations from
functions in <scad-utils/transformations.scad>. Each of these transformations
are applied to the coordinates in shape to get their current position, and then
joined to their previous operation.
Transformations from <scad-utils/transformations.scad> are basically functions
(translation, rotation, and scaling) that are analogous to the standard
rotate(), translate() and scale() operations in OpenSCAD. These all generate 4x4
matrices representing the operation. These matrices can be multiplied together
to combine them in a similar order to how OpenSCAD works.
closed is a boolean value defining whether or not you want your shape to be a
closed loop. A rubber band is a closed loop, a string is open-ended.
Here's an example:
sweep (circle (10, $fn = 20), [translation ([0, 0, 0]), translation ([0, 0, 20])]);
which is equivalent to:
linear_extrude (height = 20)
circle (r = 10, $fn = 20);
or
hull () {
translate ([0, 0, 0])
cylinder (r = 10, h = 0, $fn = 20);
translate ([0, 0, 20])
cylinder (r = 10, h = 0, $fn = 20);
}
Note that the last implementation won't actually work because you can't have a
cylinder with 0 height, but that's essentially what a circle is.
--
Kind regards,
Loong Jin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20150429/de06439a/attachment.asc>
More information about the Discuss
mailing list