Merge branch 'master' into master

This commit is contained in:
Revar Desmera 2021-12-13 15:46:30 -08:00 committed by GitHub
commit 8a16c0d826
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 7 deletions

View file

@ -776,7 +776,6 @@ function group_sort(list, idx) =
// Usage:
// groupings = group_data(groups, values);
// Topics: List Handling
// See Also: zip()
// Description:
// Given a list of integer group numbers, and an equal-length list of values,
// returns a list of groups with the values sorted into the corresponding groups.

View file

@ -156,6 +156,8 @@ function stroke(
trim, trim1, trim2,
convexity=10, hull=true
) = no_function("stroke");
module stroke(
path, width=1, closed,
endcaps, endcap1, endcap2, joints, dots,
@ -297,9 +299,33 @@ module stroke(
if (len(path) == 1) {
if (len(path[0]) == 2) {
translate(path[0]) circle(d=width[0]);
// Endcap1
setcolor(endcap_color1) {
translate(path[0]) {
mat = is_undef(endcap_angle1)? ident(3) : zrot(endcap_angle1);
multmatrix(mat) polygon(endcap_shape1);
}
}
} else {
translate(path[0]) sphere(d=width[0]);
// Endcap1
setcolor(endcap_color1) {
translate(path[0]) {
$fn = segs(width[0]/2);
if (is_undef(endcap_angle1)) {
rotate_extrude(convexity=convexity) {
right_half(planar=true) {
polygon(endcap_shape1);
}
}
} else {
rotate([90,0,endcap_angle1]) {
linear_extrude(height=max(widths[0],0.001), center=true, convexity=convexity) {
polygon(endcap_shape1);
}
}
}
}
}
}
} else {
dummy=assert(trim1<path_length(path)-trim2, "Path is too short for endcap(s). Try a smaller width, or set endcap_length to a smaller value.");

View file

@ -137,7 +137,7 @@ hexagon(d=50, anchor=LEFT);
```
```openscad-2D
oval(d=[50,30], anchor=FRONT);
ellipse(d=[50,30], anchor=FRONT);
```
@ -166,7 +166,7 @@ square([40,30], spin=30);
```
```openscad-2D
oval(d=[40,30], spin=30);
ellipse(d=[40,30], spin=30);
```
@ -821,10 +821,10 @@ module ovalish(l,rx1,ry1,rx2,ry2, anchor=CENTER, spin=0, orient=UP) {
hull() {
up(l/2-0.005)
linear_extrude(height=0.01, center=true)
oval([rx2,ry2]);
ellipse([rx2,ry2]);
down(l/2-0.005)
linear_extrude(height=0.01, center=true)
oval([rx1,ry1]);
ellipse([rx1,ry1]);
}
children();
}