mirror of
https://github.com/revarbat/BOSL2.git
synced 2025-01-16 13:50:23 +01:00
commit
44dc7945c7
@ -779,7 +779,7 @@ function _make_anchor_legal(anchor,geom) =
|
|||||||
// .
|
// .
|
||||||
// If you give `inside=true` then the anchor arrows are lined up so they are pointing the same direction and
|
// If you give `inside=true` then the anchor arrows are lined up so they are pointing the same direction and
|
||||||
// the child object will be located inside the parent. In this case a default "remove" tag is applied to
|
// the child object will be located inside the parent. In this case a default "remove" tag is applied to
|
||||||
// the children.
|
// the children.
|
||||||
// .
|
// .
|
||||||
// Because the attachment process forces an orientation and anchor point for the child, it overrides
|
// Because the attachment process forces an orientation and anchor point for the child, it overrides
|
||||||
// any such specifications you give to the child: **both `anchor=` and `orient=` given to the child are
|
// any such specifications you give to the child: **both `anchor=` and `orient=` given to the child are
|
||||||
@ -797,10 +797,17 @@ function _make_anchor_legal(anchor,geom) =
|
|||||||
// These options will probably be necessary, in fact, to get the child correctly positioned. Note that
|
// These options will probably be necessary, in fact, to get the child correctly positioned. Note that
|
||||||
// giving `spin=` to `attach()` in this case is the same as applying `zrot()` to the child.
|
// giving `spin=` to `attach()` in this case is the same as applying `zrot()` to the child.
|
||||||
// .
|
// .
|
||||||
// Attached children may be ovarlapped into the parent a bit, as given by the `$overlap` value
|
// You can overlap attached children into the parent by giving the `$overlap` value
|
||||||
// which is 0 by default, or by the `overlap=` argument. This is to prevent OpenSCAD
|
// which is 0 by default, or by the `overlap=` argument. This is to prevent OpenSCAD
|
||||||
// from making non-manifold objects. You can define `$overlap=` as an argument in a parent
|
// from making non-manifold objects. You can define `$overlap=` as an argument in a parent
|
||||||
// module to set the default for all attachments to it.
|
// module to set the default for all attachments to it. When you give `inside=true`, a positive overlap
|
||||||
|
// value shifts the child object outward.
|
||||||
|
// .
|
||||||
|
// If you specify an `inset=` value then the child is shifted away from any edges it is aligned to, towards the middle
|
||||||
|
// of the parent. The `shiftout=` parameter is intended to simplify differences with aligned objects
|
||||||
|
// placed inside the parent. It will shift the child outward along every direction where it is aligned with
|
||||||
|
// the parent. For an inside child this is equivalent to giving a positive overlap and negative inset value.
|
||||||
|
// For a child with `inside=false` it is equivalent to a negative overlap and negative inset.
|
||||||
// .
|
// .
|
||||||
// For a step-by-step explanation of
|
// For a step-by-step explanation of
|
||||||
// attachments, see the [Attachments Tutorial](Tutorial-Attachments).
|
// attachments, see the [Attachments Tutorial](Tutorial-Attachments).
|
||||||
@ -916,7 +923,7 @@ module attach(parent, child, overlap, align, spin=0, norot, inset=0, shiftout=0,
|
|||||||
anchor_data = _find_anchor(anchor, $parent_geom);
|
anchor_data = _find_anchor(anchor, $parent_geom);
|
||||||
anchor_pos = anchor_data[1];
|
anchor_pos = anchor_data[1];
|
||||||
anchor_dir = factor*anchor_data[2];
|
anchor_dir = factor*anchor_data[2];
|
||||||
anchor_spin = !inside || anchor_data[3]==0 ? anchor_data[3] : 180+anchor_data[3];
|
anchor_spin = !inside || anchor==TOP || anchor==BOT ? anchor_data[3] : 180+anchor_data[3];
|
||||||
$anchor=anchor;
|
$anchor=anchor;
|
||||||
for(align_ind = idx(align_list)){
|
for(align_ind = idx(align_list)){
|
||||||
align = is_undef(align_list[align_ind]) ? undef
|
align = is_undef(align_list[align_ind]) ? undef
|
||||||
|
21
beziers.scad
21
beziers.scad
@ -1455,14 +1455,18 @@ function bezier_patch_normals(patch, u, v) =
|
|||||||
// Usage:
|
// Usage:
|
||||||
// debug_bezier(bez, [size], [N=]);
|
// debug_bezier(bez, [size], [N=]);
|
||||||
// Description:
|
// Description:
|
||||||
// Renders 2D or 3D bezier paths and their associated control points.
|
// Renders 2D or 3D bezier paths and their associated control points to help debug bezier paths.
|
||||||
// Useful for debugging bezier paths.
|
// The endpoints of each bezier curve in the bezier path are marked with a blue circle and the intermediate control
|
||||||
|
// points with a red plus sign. For cubic (degree 3) bezier paths, the module displays the standard representation
|
||||||
|
// of the control points as "handles" at each endpoint. For other degrees the control points are drawn as
|
||||||
|
// a polygon. You can of course give a single bezier curve as input, but you must in that case explicitly specify
|
||||||
|
// the bezier degree when it is not a cubic bezier.
|
||||||
// Arguments:
|
// Arguments:
|
||||||
// bez = the array of points in the bezier.
|
// bez = the array of points in the bezier.
|
||||||
// size = diameter of the lines drawn.
|
// size = diameter of the lines drawn.
|
||||||
// ---
|
// ---
|
||||||
// N = Mark the first and every Nth vertex after in a different color and shape.
|
// N = The degree of the bezier curves. Cubic beziers have N=3. Default: 3
|
||||||
// Example(2D):
|
// Example(2D): Cubic bezier path
|
||||||
// bez = [
|
// bez = [
|
||||||
// [-10, 0], [-15, -5],
|
// [-10, 0], [-15, -5],
|
||||||
// [ -5, -10], [ 0, -10], [ 5, -10],
|
// [ -5, -10], [ 0, -10], [ 5, -10],
|
||||||
@ -1470,6 +1474,15 @@ function bezier_patch_normals(patch, u, v) =
|
|||||||
// [ 5, 10], [ 0, 10]
|
// [ 5, 10], [ 0, 10]
|
||||||
// ];
|
// ];
|
||||||
// debug_bezier(bez, N=3, width=0.5);
|
// debug_bezier(bez, N=3, width=0.5);
|
||||||
|
// Example(2D): Quartic (degree 4) bezier path
|
||||||
|
// bez = [
|
||||||
|
// [-10, 0], [-15, -5],
|
||||||
|
// [ -9, -10], [ 0, -12], [ 5, -10],
|
||||||
|
// [ 14, -5], [ 18, 0], [16, 5],
|
||||||
|
// [ 5, 10]
|
||||||
|
// ];
|
||||||
|
// debug_bezier(bez, N=4, width=0.5);
|
||||||
|
|
||||||
module debug_bezier(bezpath, width=1, N=3) {
|
module debug_bezier(bezpath, width=1, N=3) {
|
||||||
no_children($children);
|
no_children($children);
|
||||||
check =
|
check =
|
||||||
|
@ -130,6 +130,10 @@ function cube(size=1, center, anchor, spin=0, orient=UP) =
|
|||||||
// orient = Vector to rotate top towards. See [orient](attachments.scad#subsection-orient). Default: `UP`
|
// orient = Vector to rotate top towards. See [orient](attachments.scad#subsection-orient). Default: `UP`
|
||||||
// Example: Simple regular cube.
|
// Example: Simple regular cube.
|
||||||
// cuboid(40);
|
// cuboid(40);
|
||||||
|
// Example: Cuboid with a corner at the origin
|
||||||
|
// cuboid(40, anchor=FRONT+LEFT+BOT);
|
||||||
|
// Example: Cuboid anchored on its right face
|
||||||
|
// cuboid(40, anchor=RIGHT);
|
||||||
// Example: Cube with minimum cornerpoint given.
|
// Example: Cube with minimum cornerpoint given.
|
||||||
// cuboid(20, p1=[10,0,0]);
|
// cuboid(20, p1=[10,0,0]);
|
||||||
// Example: Rectangular cube, with given X, Y, and Z sizes.
|
// Example: Rectangular cube, with given X, Y, and Z sizes.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user