BE
Bob Ewart
Thu, Feb 24, 2022 4:10 PM
I've been working with the sweep and have run into a problem.
The base shape is the intersection of two circles with the same radius
with a hole in the middle. It looks like an eye with a width of 20 and
height of 10. It is a valid region.
When I sweep that shape, it fails. Intersecting that shape with a
rectangle with width = 19.990, it works. A width of the cut box greater
than 19.990 fails. Taking out the hole works even with no cut.
Test case below
The preview shows the shape used by sweep and the intersection of the
circles with the cut box.
The error generated by having the hole and increasing the width of the
cut box to >= 19.991 or removing it results in:
ERROR: Assertion 'is_path(points, dim = undef, fast = true)' failed:
"Input to path3d is not a path" in file
../.local/share/OpenSCAD/libraries/BOSL2/coords.scad, line 73
TRACE: called by 'path3d' in file
../.local/share/OpenSCAD/libraries/BOSL2/vnf.scad, line 510
TRACE: called by 'vnf_from_region' in file
../.local/share/OpenSCAD/libraries/BOSL2/skin.scad, line 1402
TRACE: called by 'sweep' in file
../.local/share/OpenSCAD/libraries/BOSL2/skin.scad, line 1416
TRACE: called by 'sweep' in file testchord5.scad, line 62
TRACE: called by 'if' in file testchord5.scad, line 62
TRACE: called by 'if' in file testchord5.scad, line 46
It works if you remove the hole no matter what the cut box is set to.
<code>
include <BOSL2/std.scad> $fn = 96; // height maxZ = 60; // width of
circle intersection chord = 20; // height of circle intersection sag2 =
10; // width of cut shape cut = 19.990; // do the sweep doSweep = true;
// do center hole doHole = true; // do chop doCut = true; module
dummy(){} function r_sag_chord(sag,chord) = sag/2 + chord^2 / (8sag);
rintersect = r_sag_chord(sag2/2,chord); // radii of the circles dy =
rintersect-sag2/2; // displacement of intersecting circles echo("\nInput
parameters", chord=chord, sag2=sag2, cut=cut); echo("control switches ",
doCut=doCut, doHole=doHole, doSweep=doSweep); echo(str("calculated
values radius=",rintersect," center shift=",dy)); scaleX = [ 1.0, 1.1,
1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8]; scaleY = [ 1.0, 0.9, 0.8, 0.7, 0.65,
0.63, 0.6, 0.55, 0.5]; levels = len(scaleX)-1; a = [for (i=[0:levels])
up(imaxZ/levels)xscale(scaleX[i]) yscale(scaleY[i])]; shape1 =
move([0,dy,0], p=circle(r=rintersect)); shape2 = move([0,-dy,0],
p=circle(r=rintersect)); shapei = intersection(shape1,shape2); //
interection of the circles shapecut= rect([cut, sag2+1]); // cut box
shapeic = intersection(shapei, shapecut); // intersection cut off shape
= (doCut)? (doHole)? difference(shapeic, circle(d=4)) // shape with hole
and cut : shapeic // shape cut with no hole : (doHole)?
difference(shapei, circle(d=4)) // uncut shape with hole : shapei; //
uncut shape with no hole if (is_valid_region(shape)) { echo("shape OK");
if($preview) { // show original shapes // outside shape with cut box in
red translate([0,-20,0]) stroke(shapei, width=.1); if(doCut)
color("red") { translate([0,-20,0]) stroke(shapecut, width=.1,
closed=true); translate([chord/2+3,-20,0]) text("cut box",size=2); }
translate([0,-30,0]) text("Intersection of circles", size=2,
halign="center"); // bottom shape translate([0,-40,0]) stroke(shape,
width=.1); translate([0,-50,0]) text("input to shape", size=2,
halign="center"); } if(doSweep) sweep(shape, a); } else { echo("shape
NG"); }
</code>
--
Bob
I've been working with the sweep and have run into a problem.
The base shape is the intersection of two circles with the same radius
with a hole in the middle. It looks like an eye with a width of 20 and
height of 10. It is a valid region.
When I sweep that shape, it fails. Intersecting that shape with a
rectangle with width = 19.990, it works. A width of the cut box greater
than 19.990 fails. Taking out the hole works even with no cut.
Test case below
The preview shows the shape used by sweep and the intersection of the
circles with the cut box.
The error generated by having the hole and increasing the width of the
cut box to >= 19.991 or removing it results in:
ERROR: Assertion 'is_path(points, dim = undef, fast = true)' failed:
"Input to path3d is not a path" in file
../.local/share/OpenSCAD/libraries/BOSL2/coords.scad, line 73
TRACE: called by 'path3d' in file
../.local/share/OpenSCAD/libraries/BOSL2/vnf.scad, line 510
TRACE: called by 'vnf_from_region' in file
../.local/share/OpenSCAD/libraries/BOSL2/skin.scad, line 1402
TRACE: called by 'sweep' in file
../.local/share/OpenSCAD/libraries/BOSL2/skin.scad, line 1416
TRACE: called by 'sweep' in file testchord5.scad, line 62
TRACE: called by 'if' in file testchord5.scad, line 62
TRACE: called by 'if' in file testchord5.scad, line 46
It works if you remove the hole no matter what the cut box is set to.
<code>
include <BOSL2/std.scad> $fn = 96; // height maxZ = 60; // width of
circle intersection chord = 20; // height of circle intersection sag2 =
10; // width of cut shape cut = 19.990; // do the sweep doSweep = true;
// do center hole doHole = true; // do chop doCut = true; module
dummy(){} function r_sag_chord(sag,chord) = sag/2 + chord^2 / (8*sag);
rintersect = r_sag_chord(sag2/2,chord); // radii of the circles dy =
rintersect-sag2/2; // displacement of intersecting circles echo("\nInput
parameters", chord=chord, sag2=sag2, cut=cut); echo("control switches ",
doCut=doCut, doHole=doHole, doSweep=doSweep); echo(str("calculated
values radius=",rintersect," center shift=",dy)); scaleX = [ 1.0, 1.1,
1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8]; scaleY = [ 1.0, 0.9, 0.8, 0.7, 0.65,
0.63, 0.6, 0.55, 0.5]; levels = len(scaleX)-1; a = [for (i=[0:levels])
up(i*maxZ/levels)*xscale(scaleX[i])* yscale(scaleY[i])]; shape1 =
move([0,dy,0], p=circle(r=rintersect)); shape2 = move([0,-dy,0],
p=circle(r=rintersect)); shapei = intersection(shape1,shape2); //
interection of the circles shapecut= rect([cut, sag2+1]); // cut box
shapeic = intersection(shapei, shapecut); // intersection cut off shape
= (doCut)? (doHole)? difference(shapeic, circle(d=4)) // shape with hole
and cut : shapeic // shape cut with no hole : (doHole)?
difference(shapei, circle(d=4)) // uncut shape with hole : shapei; //
uncut shape with no hole if (is_valid_region(shape)) { echo("shape OK");
if($preview) { // show original shapes // outside shape with cut box in
red translate([0,-20,0]) stroke(shapei, width=.1); if(doCut)
color("red") { translate([0,-20,0]) stroke(shapecut, width=.1,
closed=true); translate([chord/2+3,-20,0]) text("cut box",size=2); }
translate([0,-30,0]) text("Intersection of circles", size=2,
halign="center"); // bottom shape translate([0,-40,0]) stroke(shape,
width=.1); translate([0,-50,0]) text("input to shape", size=2,
halign="center"); } if(doSweep) sweep(shape, a); } else { echo("shape
NG"); }
</code>
--
Bob
AM
Adrian Mariano
Thu, Feb 24, 2022 8:50 PM
Can you post a non-mangled version of your code? It's been
reformatted into a single line.
On Thu, Feb 24, 2022 at 11:11 AM Bob Ewart jinnicky@bobsown.net wrote:
I've been working with the sweep and have run into a problem.
The base shape is the intersection of two circles with the same radius with a hole in the middle. It looks like an eye with a width of 20 and height of 10. It is a valid region.
When I sweep that shape, it fails. Intersecting that shape with a rectangle with width = 19.990, it works. A width of the cut box greater than 19.990 fails. Taking out the hole works even with no cut.
Test case below
The preview shows the shape used by sweep and the intersection of the circles with the cut box.
The error generated by having the hole and increasing the width of the cut box to >= 19.991 or removing it results in:
ERROR: Assertion 'is_path(points, dim = undef, fast = true)' failed: "Input to path3d is not a path" in file ../.local/share/OpenSCAD/libraries/BOSL2/coords.scad, line 73
TRACE: called by 'path3d' in file ../.local/share/OpenSCAD/libraries/BOSL2/vnf.scad, line 510
TRACE: called by 'vnf_from_region' in file ../.local/share/OpenSCAD/libraries/BOSL2/skin.scad, line 1402
TRACE: called by 'sweep' in file ../.local/share/OpenSCAD/libraries/BOSL2/skin.scad, line 1416
TRACE: called by 'sweep' in file testchord5.scad, line 62
TRACE: called by 'if' in file testchord5.scad, line 62
TRACE: called by 'if' in file testchord5.scad, line 46
It works if you remove the hole no matter what the cut box is set to.
<code>
include <BOSL2/std.scad> $fn = 96; // height maxZ = 60; // width of circle intersection chord = 20; // height of circle intersection sag2 = 10; // width of cut shape cut = 19.990; // do the sweep doSweep = true; // do center hole doHole = true; // do chop doCut = true; module dummy(){} function r_sag_chord(sag,chord) = sag/2 + chord^2 / (8sag); rintersect = r_sag_chord(sag2/2,chord); // radii of the circles dy = rintersect-sag2/2; // displacement of intersecting circles echo("\nInput parameters", chord=chord, sag2=sag2, cut=cut); echo("control switches ", doCut=doCut, doHole=doHole, doSweep=doSweep); echo(str("calculated values radius=",rintersect," center shift=",dy)); scaleX = [ 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8]; scaleY = [ 1.0, 0.9, 0.8, 0.7, 0.65, 0.63, 0.6, 0.55, 0.5]; levels = len(scaleX)-1; a = [for (i=[0:levels]) up(imaxZ/levels)xscale(scaleX[i]) yscale(scaleY[i])]; shape1 = move([0,dy,0], p=circle(r=rintersect)); shape2 = move([0,-dy,0], p=circle(r=rintersect)); shapei = intersection(shape1,shape2); // interection of the circles shapecut= rect([cut, sag2+1]); // cut box shapeic = intersection(shapei, shapecut); // intersection cut off shape = (doCut)? (doHole)? difference(shapeic, circle(d=4)) // shape with hole and cut : shapeic // shape cut with no hole : (doHole)? difference(shapei, circle(d=4)) // uncut shape with hole : shapei; // uncut shape with no hole if (is_valid_region(shape)) { echo("shape OK"); if($preview) { // show original shapes // outside shape with cut box in red translate([0,-20,0]) stroke(shapei, width=.1); if(doCut) color("red") { translate([0,-20,0]) stroke(shapecut, width=.1, closed=true); translate([chord/2+3,-20,0]) text("cut box",size=2); } translate([0,-30,0]) text("Intersection of circles", size=2, halign="center"); // bottom shape translate([0,-40,0]) stroke(shape, width=.1); translate([0,-50,0]) text("input to shape", size=2, halign="center"); } if(doSweep) sweep(shape, a); } else { echo("shape NG"); }
</code>
--
Bob
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
Can you post a non-mangled version of your code? It's been
reformatted into a single line.
On Thu, Feb 24, 2022 at 11:11 AM Bob Ewart <jinnicky@bobsown.net> wrote:
>
> I've been working with the sweep and have run into a problem.
>
> The base shape is the intersection of two circles with the same radius with a hole in the middle. It looks like an eye with a width of 20 and height of 10. It is a valid region.
>
> When I sweep that shape, it fails. Intersecting that shape with a rectangle with width = 19.990, it works. A width of the cut box greater than 19.990 fails. Taking out the hole works even with no cut.
>
> Test case below
>
> The preview shows the shape used by sweep and the intersection of the circles with the cut box.
>
> The error generated by having the hole and increasing the width of the cut box to >= 19.991 or removing it results in:
>
> ERROR: Assertion 'is_path(points, dim = undef, fast = true)' failed: "Input to path3d is not a path" in file ../.local/share/OpenSCAD/libraries/BOSL2/coords.scad, line 73
>
> TRACE: called by 'path3d' in file ../.local/share/OpenSCAD/libraries/BOSL2/vnf.scad, line 510
>
> TRACE: called by 'vnf_from_region' in file ../.local/share/OpenSCAD/libraries/BOSL2/skin.scad, line 1402
>
> TRACE: called by 'sweep' in file ../.local/share/OpenSCAD/libraries/BOSL2/skin.scad, line 1416
>
> TRACE: called by 'sweep' in file testchord5.scad, line 62
>
> TRACE: called by 'if' in file testchord5.scad, line 62
>
> TRACE: called by 'if' in file testchord5.scad, line 46
>
> It works if you remove the hole no matter what the cut box is set to.
>
> <code>
>
> include <BOSL2/std.scad> $fn = 96; // height maxZ = 60; // width of circle intersection chord = 20; // height of circle intersection sag2 = 10; // width of cut shape cut = 19.990; // do the sweep doSweep = true; // do center hole doHole = true; // do chop doCut = true; module dummy(){} function r_sag_chord(sag,chord) = sag/2 + chord^2 / (8*sag); rintersect = r_sag_chord(sag2/2,chord); // radii of the circles dy = rintersect-sag2/2; // displacement of intersecting circles echo("\nInput parameters", chord=chord, sag2=sag2, cut=cut); echo("control switches ", doCut=doCut, doHole=doHole, doSweep=doSweep); echo(str("calculated values radius=",rintersect," center shift=",dy)); scaleX = [ 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8]; scaleY = [ 1.0, 0.9, 0.8, 0.7, 0.65, 0.63, 0.6, 0.55, 0.5]; levels = len(scaleX)-1; a = [for (i=[0:levels]) up(i*maxZ/levels)*xscale(scaleX[i])* yscale(scaleY[i])]; shape1 = move([0,dy,0], p=circle(r=rintersect)); shape2 = move([0,-dy,0], p=circle(r=rintersect)); shapei = intersection(shape1,shape2); // interection of the circles shapecut= rect([cut, sag2+1]); // cut box shapeic = intersection(shapei, shapecut); // intersection cut off shape = (doCut)? (doHole)? difference(shapeic, circle(d=4)) // shape with hole and cut : shapeic // shape cut with no hole : (doHole)? difference(shapei, circle(d=4)) // uncut shape with hole : shapei; // uncut shape with no hole if (is_valid_region(shape)) { echo("shape OK"); if($preview) { // show original shapes // outside shape with cut box in red translate([0,-20,0]) stroke(shapei, width=.1); if(doCut) color("red") { translate([0,-20,0]) stroke(shapecut, width=.1, closed=true); translate([chord/2+3,-20,0]) text("cut box",size=2); } translate([0,-30,0]) text("Intersection of circles", size=2, halign="center"); // bottom shape translate([0,-40,0]) stroke(shape, width=.1); translate([0,-50,0]) text("input to shape", size=2, halign="center"); } if(doSweep) sweep(shape, a); } else { echo("shape NG"); }
>
> </code>
>
> --
> Bob
>
> _______________________________________________
> OpenSCAD mailing list
> To unsubscribe send an email to discuss-leave@lists.openscad.org
LM
Leonard Martin Struttmann
Sat, Feb 26, 2022 4:22 PM
This works:
//shape = difference(shapei, circle(d=4)); // shape with hole
//
//if (is_valid_region(shapei)) {
// echo("\n\nshape is a valid region\n\n");
// sweep(shapei, T);
//} else {
// echo("shapei NG");
//}
difference()
{
sweep(shapei, T);
sweep(circle(d=4),T);
}
On Thu, Feb 24, 2022 at 2:50 PM Adrian Mariano avm4@cornell.edu wrote:
Can you post a non-mangled version of your code? It's been
reformatted into a single line.
On Thu, Feb 24, 2022 at 11:11 AM Bob Ewart jinnicky@bobsown.net wrote:
I've been working with the sweep and have run into a problem.
The base shape is the intersection of two circles with the same radius
with a hole in the middle. It looks like an eye with a width of 20 and
height of 10. It is a valid region.
When I sweep that shape, it fails. Intersecting that shape with a
rectangle with width = 19.990, it works. A width of the cut box greater
than 19.990 fails. Taking out the hole works even with no cut.
Test case below
The preview shows the shape used by sweep and the intersection of the
circles with the cut box.
The error generated by having the hole and increasing the width of the
cut box to >= 19.991 or removing it results in:
ERROR: Assertion 'is_path(points, dim = undef, fast = true)' failed:
"Input to path3d is not a path" in file
../.local/share/OpenSCAD/libraries/BOSL2/coords.scad, line 73
TRACE: called by 'path3d' in file
../.local/share/OpenSCAD/libraries/BOSL2/vnf.scad, line 510
TRACE: called by 'vnf_from_region' in file
../.local/share/OpenSCAD/libraries/BOSL2/skin.scad, line 1402
TRACE: called by 'sweep' in file
../.local/share/OpenSCAD/libraries/BOSL2/skin.scad, line 1416
TRACE: called by 'sweep' in file testchord5.scad, line 62
TRACE: called by 'if' in file testchord5.scad, line 62
TRACE: called by 'if' in file testchord5.scad, line 46
It works if you remove the hole no matter what the cut box is set to.
<code>
include <BOSL2/std.scad> $fn = 96; // height maxZ = 60; // width of
circle intersection chord = 20; // height of circle intersection sag2 = 10;
// width of cut shape cut = 19.990; // do the sweep doSweep = true; // do
center hole doHole = true; // do chop doCut = true; module dummy(){}
function r_sag_chord(sag,chord) = sag/2 + chord^2 / (8sag); rintersect =
r_sag_chord(sag2/2,chord); // radii of the circles dy = rintersect-sag2/2;
// displacement of intersecting circles echo("\nInput parameters",
chord=chord, sag2=sag2, cut=cut); echo("control switches ", doCut=doCut,
doHole=doHole, doSweep=doSweep); echo(str("calculated values
radius=",rintersect," center shift=",dy)); scaleX = [ 1.0, 1.1, 1.2, 1.3,
1.4, 1.5, 1.6, 1.7, 1.8]; scaleY = [ 1.0, 0.9, 0.8, 0.7, 0.65, 0.63, 0.6,
0.55, 0.5]; levels = len(scaleX)-1; a = [for (i=[0:levels])
up(imaxZ/levels)xscale(scaleX[i]) yscale(scaleY[i])]; shape1 =
move([0,dy,0], p=circle(r=rintersect)); shape2 = move([0,-dy,0],
p=circle(r=rintersec
t)); shapei = intersection(shape1,shape2); // interection of the circles
shapecut= rect([cut, sag2+1]); // cut box shapeic = intersection(shapei,
shapecut); // intersection cut off shape = (doCut)? (doHole)?
difference(shapeic, circle(d=4)) // shape with hole and cut : shapeic //
shape cut with no hole : (doHole)? difference(shapei, circle(d=4)) // uncut
shape with hole : shapei; // uncut shape with no hole if
(is_valid_region(shape)) { echo("shape OK"); if($preview) { // show
original shapes // outside shape with cut box in red translate([0,-20,0])
stroke(shapei, width=.1); if(doCut) color("red") { translate([0,-20,0])
stroke(shapecut, width=.1, closed=true); translate([chord/2+3,-20,0])
text("cut box",size=2); } translate([0,-30,0]) text("Intersection of
circles", size=2, halign="center"); // bottom shape translate([0,-40,0])
stroke(shape, width=.1); translate([0,-50,0]) text("input to shape",
size=2, halign="center"); } if(doSweep) sweep(shape, a); } else {
echo("shape NG"); }
This works:
//shape = difference(shapei, circle(d=4)); // shape with hole
//
//if (is_valid_region(shapei)) {
// echo("\n\nshape is a valid region\n\n");
// sweep(shapei, T);
//} else {
// echo("shapei NG");
//}
difference()
{
sweep(shapei, T);
sweep(circle(d=4),T);
}
On Thu, Feb 24, 2022 at 2:50 PM Adrian Mariano <avm4@cornell.edu> wrote:
> Can you post a non-mangled version of your code? It's been
> reformatted into a single line.
>
> On Thu, Feb 24, 2022 at 11:11 AM Bob Ewart <jinnicky@bobsown.net> wrote:
> >
> > I've been working with the sweep and have run into a problem.
> >
> > The base shape is the intersection of two circles with the same radius
> with a hole in the middle. It looks like an eye with a width of 20 and
> height of 10. It is a valid region.
> >
> > When I sweep that shape, it fails. Intersecting that shape with a
> rectangle with width = 19.990, it works. A width of the cut box greater
> than 19.990 fails. Taking out the hole works even with no cut.
> >
> > Test case below
> >
> > The preview shows the shape used by sweep and the intersection of the
> circles with the cut box.
> >
> > The error generated by having the hole and increasing the width of the
> cut box to >= 19.991 or removing it results in:
> >
> > ERROR: Assertion 'is_path(points, dim = undef, fast = true)' failed:
> "Input to path3d is not a path" in file
> ../.local/share/OpenSCAD/libraries/BOSL2/coords.scad, line 73
> >
> > TRACE: called by 'path3d' in file
> ../.local/share/OpenSCAD/libraries/BOSL2/vnf.scad, line 510
> >
> > TRACE: called by 'vnf_from_region' in file
> ../.local/share/OpenSCAD/libraries/BOSL2/skin.scad, line 1402
> >
> > TRACE: called by 'sweep' in file
> ../.local/share/OpenSCAD/libraries/BOSL2/skin.scad, line 1416
> >
> > TRACE: called by 'sweep' in file testchord5.scad, line 62
> >
> > TRACE: called by 'if' in file testchord5.scad, line 62
> >
> > TRACE: called by 'if' in file testchord5.scad, line 46
> >
> > It works if you remove the hole no matter what the cut box is set to.
> >
> > <code>
> >
> > include <BOSL2/std.scad> $fn = 96; // height maxZ = 60; // width of
> circle intersection chord = 20; // height of circle intersection sag2 = 10;
> // width of cut shape cut = 19.990; // do the sweep doSweep = true; // do
> center hole doHole = true; // do chop doCut = true; module dummy(){}
> function r_sag_chord(sag,chord) = sag/2 + chord^2 / (8*sag); rintersect =
> r_sag_chord(sag2/2,chord); // radii of the circles dy = rintersect-sag2/2;
> // displacement of intersecting circles echo("\nInput parameters",
> chord=chord, sag2=sag2, cut=cut); echo("control switches ", doCut=doCut,
> doHole=doHole, doSweep=doSweep); echo(str("calculated values
> radius=",rintersect," center shift=",dy)); scaleX = [ 1.0, 1.1, 1.2, 1.3,
> 1.4, 1.5, 1.6, 1.7, 1.8]; scaleY = [ 1.0, 0.9, 0.8, 0.7, 0.65, 0.63, 0.6,
> 0.55, 0.5]; levels = len(scaleX)-1; a = [for (i=[0:levels])
> up(i*maxZ/levels)*xscale(scaleX[i])* yscale(scaleY[i])]; shape1 =
> move([0,dy,0], p=circle(r=rintersect)); shape2 = move([0,-dy,0],
> p=circle(r=rintersec
> t)); shapei = intersection(shape1,shape2); // interection of the circles
> shapecut= rect([cut, sag2+1]); // cut box shapeic = intersection(shapei,
> shapecut); // intersection cut off shape = (doCut)? (doHole)?
> difference(shapeic, circle(d=4)) // shape with hole and cut : shapeic //
> shape cut with no hole : (doHole)? difference(shapei, circle(d=4)) // uncut
> shape with hole : shapei; // uncut shape with no hole if
> (is_valid_region(shape)) { echo("shape OK"); if($preview) { // show
> original shapes // outside shape with cut box in red translate([0,-20,0])
> stroke(shapei, width=.1); if(doCut) color("red") { translate([0,-20,0])
> stroke(shapecut, width=.1, closed=true); translate([chord/2+3,-20,0])
> text("cut box",size=2); } translate([0,-30,0]) text("Intersection of
> circles", size=2, halign="center"); // bottom shape translate([0,-40,0])
> stroke(shape, width=.1); translate([0,-50,0]) text("input to shape",
> size=2, halign="center"); } if(doSweep) sweep(shape, a); } else {
> echo("shape NG"); }
> >
> > </code>
> >
> > --
> > Bob
> >
> > _______________________________________________
> > OpenSCAD mailing list
> > To unsubscribe send an email to discuss-leave@lists.openscad.org
> _______________________________________________
> OpenSCAD mailing list
> To unsubscribe send an email to discuss-leave@lists.openscad.org
>
AM
Adrian Mariano
Sat, Feb 26, 2022 4:36 PM
Yeah, that's a workaround, though possibly you have issues because the
cut-out shape isn't longer than the parent shape.
The real answer is that there's a bug in BOSL2 in an internal function
for cutting regions into polygons. A fix is available, probably will
get posted tonight.
On Sat, Feb 26, 2022 at 11:23 AM Leonard Martin Struttmann
lenstruttmann@gmail.com wrote:
This works:
//shape = difference(shapei, circle(d=4)); // shape with hole
//
//if (is_valid_region(shapei)) {
// echo("\n\nshape is a valid region\n\n");
// sweep(shapei, T);
//} else {
// echo("shapei NG");
//}
difference()
{
sweep(shapei, T);
sweep(circle(d=4),T);
}
On Thu, Feb 24, 2022 at 2:50 PM Adrian Mariano avm4@cornell.edu wrote:
Can you post a non-mangled version of your code? It's been
reformatted into a single line.
On Thu, Feb 24, 2022 at 11:11 AM Bob Ewart jinnicky@bobsown.net wrote:
I've been working with the sweep and have run into a problem.
The base shape is the intersection of two circles with the same radius with a hole in the middle. It looks like an eye with a width of 20 and height of 10. It is a valid region.
When I sweep that shape, it fails. Intersecting that shape with a rectangle with width = 19.990, it works. A width of the cut box greater than 19.990 fails. Taking out the hole works even with no cut.
Test case below
The preview shows the shape used by sweep and the intersection of the circles with the cut box.
The error generated by having the hole and increasing the width of the cut box to >= 19.991 or removing it results in:
ERROR: Assertion 'is_path(points, dim = undef, fast = true)' failed: "Input to path3d is not a path" in file ../.local/share/OpenSCAD/libraries/BOSL2/coords.scad, line 73
TRACE: called by 'path3d' in file ../.local/share/OpenSCAD/libraries/BOSL2/vnf.scad, line 510
TRACE: called by 'vnf_from_region' in file ../.local/share/OpenSCAD/libraries/BOSL2/skin.scad, line 1402
TRACE: called by 'sweep' in file ../.local/share/OpenSCAD/libraries/BOSL2/skin.scad, line 1416
TRACE: called by 'sweep' in file testchord5.scad, line 62
TRACE: called by 'if' in file testchord5.scad, line 62
TRACE: called by 'if' in file testchord5.scad, line 46
It works if you remove the hole no matter what the cut box is set to.
<code>
include <BOSL2/std.scad> $fn = 96; // height maxZ = 60; // width of circle intersection chord = 20; // height of circle intersection sag2 = 10; // width of cut shape cut = 19.990; // do the sweep doSweep = true; // do center hole doHole = true; // do chop doCut = true; module dummy(){} function r_sag_chord(sag,chord) = sag/2 + chord^2 / (8sag); rintersect = r_sag_chord(sag2/2,chord); // radii of the circles dy = rintersect-sag2/2; // displacement of intersecting circles echo("\nInput parameters", chord=chord, sag2=sag2, cut=cut); echo("control switches ", doCut=doCut, doHole=doHole, doSweep=doSweep); echo(str("calculated values radius=",rintersect," center shift=",dy)); scaleX = [ 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8]; scaleY = [ 1.0, 0.9, 0.8, 0.7, 0.65, 0.63, 0.6, 0.55, 0.5]; levels = len(scaleX)-1; a = [for (i=[0:levels]) up(imaxZ/levels)xscale(scaleX[i]) yscale(scaleY[i])]; shape1 = move([0,dy,0], p=circle(r=rintersect)); shape2 = move([0,-dy,0], p=circle(r=rintersec
t)); shapei = intersection(shape1,shape2); // interection of the circles shapecut= rect([cut, sag2+1]); // cut box shapeic = intersection(shapei, shapecut); // intersection cut off shape = (doCut)? (doHole)? difference(shapeic, circle(d=4)) // shape with hole and cut : shapeic // shape cut with no hole : (doHole)? difference(shapei, circle(d=4)) // uncut shape with hole : shapei; // uncut shape with no hole if (is_valid_region(shape)) { echo("shape OK"); if($preview) { // show original shapes // outside shape with cut box in red translate([0,-20,0]) stroke(shapei, width=.1); if(doCut) color("red") { translate([0,-20,0]) stroke(shapecut, width=.1, closed=true); translate([chord/2+3,-20,0]) text("cut box",size=2); } translate([0,-30,0]) text("Intersection of circles", size=2, halign="center"); // bottom shape translate([0,-40,0]) stroke(shape, width=.1); translate([0,-50,0]) text("input to shape", size=2, halign="center"); } if(doSweep) sweep(shape, a); } else { echo("shape NG"); }
</code>
--
Bob
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
Yeah, that's a workaround, though possibly you have issues because the
cut-out shape isn't longer than the parent shape.
The real answer is that there's a bug in BOSL2 in an internal function
for cutting regions into polygons. A fix is available, probably will
get posted tonight.
On Sat, Feb 26, 2022 at 11:23 AM Leonard Martin Struttmann
<lenstruttmann@gmail.com> wrote:
>
> This works:
>
> //shape = difference(shapei, circle(d=4)); // shape with hole
> //
> //if (is_valid_region(shapei)) {
> // echo("\n\nshape is a valid region\n\n");
> // sweep(shapei, T);
> //} else {
> // echo("shapei NG");
> //}
>
> difference()
> {
> sweep(shapei, T);
> sweep(circle(d=4),T);
> }
>
> On Thu, Feb 24, 2022 at 2:50 PM Adrian Mariano <avm4@cornell.edu> wrote:
>>
>> Can you post a non-mangled version of your code? It's been
>> reformatted into a single line.
>>
>> On Thu, Feb 24, 2022 at 11:11 AM Bob Ewart <jinnicky@bobsown.net> wrote:
>> >
>> > I've been working with the sweep and have run into a problem.
>> >
>> > The base shape is the intersection of two circles with the same radius with a hole in the middle. It looks like an eye with a width of 20 and height of 10. It is a valid region.
>> >
>> > When I sweep that shape, it fails. Intersecting that shape with a rectangle with width = 19.990, it works. A width of the cut box greater than 19.990 fails. Taking out the hole works even with no cut.
>> >
>> > Test case below
>> >
>> > The preview shows the shape used by sweep and the intersection of the circles with the cut box.
>> >
>> > The error generated by having the hole and increasing the width of the cut box to >= 19.991 or removing it results in:
>> >
>> > ERROR: Assertion 'is_path(points, dim = undef, fast = true)' failed: "Input to path3d is not a path" in file ../.local/share/OpenSCAD/libraries/BOSL2/coords.scad, line 73
>> >
>> > TRACE: called by 'path3d' in file ../.local/share/OpenSCAD/libraries/BOSL2/vnf.scad, line 510
>> >
>> > TRACE: called by 'vnf_from_region' in file ../.local/share/OpenSCAD/libraries/BOSL2/skin.scad, line 1402
>> >
>> > TRACE: called by 'sweep' in file ../.local/share/OpenSCAD/libraries/BOSL2/skin.scad, line 1416
>> >
>> > TRACE: called by 'sweep' in file testchord5.scad, line 62
>> >
>> > TRACE: called by 'if' in file testchord5.scad, line 62
>> >
>> > TRACE: called by 'if' in file testchord5.scad, line 46
>> >
>> > It works if you remove the hole no matter what the cut box is set to.
>> >
>> > <code>
>> >
>> > include <BOSL2/std.scad> $fn = 96; // height maxZ = 60; // width of circle intersection chord = 20; // height of circle intersection sag2 = 10; // width of cut shape cut = 19.990; // do the sweep doSweep = true; // do center hole doHole = true; // do chop doCut = true; module dummy(){} function r_sag_chord(sag,chord) = sag/2 + chord^2 / (8*sag); rintersect = r_sag_chord(sag2/2,chord); // radii of the circles dy = rintersect-sag2/2; // displacement of intersecting circles echo("\nInput parameters", chord=chord, sag2=sag2, cut=cut); echo("control switches ", doCut=doCut, doHole=doHole, doSweep=doSweep); echo(str("calculated values radius=",rintersect," center shift=",dy)); scaleX = [ 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8]; scaleY = [ 1.0, 0.9, 0.8, 0.7, 0.65, 0.63, 0.6, 0.55, 0.5]; levels = len(scaleX)-1; a = [for (i=[0:levels]) up(i*maxZ/levels)*xscale(scaleX[i])* yscale(scaleY[i])]; shape1 = move([0,dy,0], p=circle(r=rintersect)); shape2 = move([0,-dy,0], p=circle(r=rintersec
>> t)); shapei = intersection(shape1,shape2); // interection of the circles shapecut= rect([cut, sag2+1]); // cut box shapeic = intersection(shapei, shapecut); // intersection cut off shape = (doCut)? (doHole)? difference(shapeic, circle(d=4)) // shape with hole and cut : shapeic // shape cut with no hole : (doHole)? difference(shapei, circle(d=4)) // uncut shape with hole : shapei; // uncut shape with no hole if (is_valid_region(shape)) { echo("shape OK"); if($preview) { // show original shapes // outside shape with cut box in red translate([0,-20,0]) stroke(shapei, width=.1); if(doCut) color("red") { translate([0,-20,0]) stroke(shapecut, width=.1, closed=true); translate([chord/2+3,-20,0]) text("cut box",size=2); } translate([0,-30,0]) text("Intersection of circles", size=2, halign="center"); // bottom shape translate([0,-40,0]) stroke(shape, width=.1); translate([0,-50,0]) text("input to shape", size=2, halign="center"); } if(doSweep) sweep(shape, a); } else { echo("shape NG"); }
>> >
>> > </code>
>> >
>> > --
>> > Bob
>> >
>> > _______________________________________________
>> > OpenSCAD mailing list
>> > To unsubscribe send an email to discuss-leave@lists.openscad.org
>> _______________________________________________
>> OpenSCAD mailing list
>> To unsubscribe send an email to discuss-leave@lists.openscad.org
>
> _______________________________________________
> OpenSCAD mailing list
> To unsubscribe send an email to discuss-leave@lists.openscad.org