discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Complex model - reducing render time

AC
A. Craig West
Fri, Apr 9, 2021 12:13 PM

I should note that it might be more efficient to build this as a
polyhedron, but the hull solution works pretty well in this example

On Fri, Apr 9, 2021 at 8:10 AM A. Craig West acraigwest@gmail.com wrote:

Try this, it is more likely to get the results you need (all of those
spheres and cylinders of matching radius and position are far too likely to
cause degenerate polygons of various types)
// sm=0.000000
$fn=30;

pts = [
[0.000000,0,10.593750],
[0.000000,0,10.406250],
[-0.003906,0,10.199219],
[-0.011719,0,9.972656],
[-0.023438,0,9.726562],
[-0.039062,0,9.460938],
[-0.058594,0,9.175781],
[-0.082031,0,8.871094],
[-0.109375,0,8.546875],
[-0.140625,0,8.203125],
[-0.175781,0,7.839844],
[-0.214844,0,7.457031],
[-0.257812,0,7.054688],
[-0.304688,0,6.632812],
[-0.355469,0,6.191406],
[-0.410156,0,5.730469],
[-0.468750,0,5.250000],
[-0.531250,0,4.750000],
[-0.582031,0,4.273438],
[-0.621094,0,3.820312],
[-0.648438,0,3.390625],
[-0.664062,0,2.984375],
[-0.667969,0,2.601562],
[-0.660156,0,2.242188],
[-0.640625,0,1.906250],
[-0.609375,0,1.593750],
[-0.566406,0,1.304688],
[-0.511719,0,1.039062],
[-0.445312,0,0.796875],
[-0.367188,0,0.578125],
[-0.277344,0,0.382812],
[-0.175781,0,0.210938],
[-0.062500,0,0.062500],
[0, 0, 0]
];

angles = [
[0,180.000000,0],
[0,181.080924,0],
[0,181.974934,0],
[0,182.726311,0],
[0,183.366461,0],
[0,183.918249,0],
[0,184.398705,0],
[0,184.820766,0],
[0,185.194429,0],
[0,185.527540,0],
[0,185.826342,0],
[0,186.095862,0],
[0,186.340192,0],
[0,186.562699,0],
[0,186.766175,0],
[0,186.952957,0],
[0,187.125016,0],
[0,186.082337,0],
[0,184.927110,0],
[0,183.641185,0],
[0,182.202598,0],
[0,180.584631,0],
[0,178.754636,0],
[0,176.672596,0],
[0,174.289407,0],
[0,171.544972,0],
[0,168.366366,0],
[0,164.666715,0],
[0,160.346176,0],
[0,155.297570,0],
[0,149.420773,0],
[0,142.650651,0],
[0,135.000000,0],
[0,135.000000,0]
];

module section(pts, angles, i, r, t) {
hull() {
translate(pts[i])
rotate(angles[i])
cylinder(r = r, h = t, center = true);
translate(pts[i + 1])
rotate(angles[i + 1])
cylinder(r = r, h = t, center = true);
}
}

for (i = [0 : len(pts) - 2])
section(pts, angles, i, 0.2, 0.01);

On Fri, Apr 9, 2021 at 7:21 AM superaorta@gmail.com wrote:

Scaling the model doesn't appear to fix anything


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

I should note that it might be more efficient to build this as a polyhedron, but the hull solution works pretty well in this example On Fri, Apr 9, 2021 at 8:10 AM A. Craig West <acraigwest@gmail.com> wrote: > Try this, it is more likely to get the results you need (all of those > spheres and cylinders of matching radius and position are far too likely to > cause degenerate polygons of various types) > // sm=0.000000 > $fn=30; > > pts = [ > [0.000000,0,10.593750], > [0.000000,0,10.406250], > [-0.003906,0,10.199219], > [-0.011719,0,9.972656], > [-0.023438,0,9.726562], > [-0.039062,0,9.460938], > [-0.058594,0,9.175781], > [-0.082031,0,8.871094], > [-0.109375,0,8.546875], > [-0.140625,0,8.203125], > [-0.175781,0,7.839844], > [-0.214844,0,7.457031], > [-0.257812,0,7.054688], > [-0.304688,0,6.632812], > [-0.355469,0,6.191406], > [-0.410156,0,5.730469], > [-0.468750,0,5.250000], > [-0.531250,0,4.750000], > [-0.582031,0,4.273438], > [-0.621094,0,3.820312], > [-0.648438,0,3.390625], > [-0.664062,0,2.984375], > [-0.667969,0,2.601562], > [-0.660156,0,2.242188], > [-0.640625,0,1.906250], > [-0.609375,0,1.593750], > [-0.566406,0,1.304688], > [-0.511719,0,1.039062], > [-0.445312,0,0.796875], > [-0.367188,0,0.578125], > [-0.277344,0,0.382812], > [-0.175781,0,0.210938], > [-0.062500,0,0.062500], > [0, 0, 0] > ]; > > angles = [ > [0,180.000000,0], > [0,181.080924,0], > [0,181.974934,0], > [0,182.726311,0], > [0,183.366461,0], > [0,183.918249,0], > [0,184.398705,0], > [0,184.820766,0], > [0,185.194429,0], > [0,185.527540,0], > [0,185.826342,0], > [0,186.095862,0], > [0,186.340192,0], > [0,186.562699,0], > [0,186.766175,0], > [0,186.952957,0], > [0,187.125016,0], > [0,186.082337,0], > [0,184.927110,0], > [0,183.641185,0], > [0,182.202598,0], > [0,180.584631,0], > [0,178.754636,0], > [0,176.672596,0], > [0,174.289407,0], > [0,171.544972,0], > [0,168.366366,0], > [0,164.666715,0], > [0,160.346176,0], > [0,155.297570,0], > [0,149.420773,0], > [0,142.650651,0], > [0,135.000000,0], > [0,135.000000,0] > ]; > > module section(pts, angles, i, r, t) { > hull() { > translate(pts[i]) > rotate(angles[i]) > cylinder(r = r, h = t, center = true); > translate(pts[i + 1]) > rotate(angles[i + 1]) > cylinder(r = r, h = t, center = true); > } > } > > for (i = [0 : len(pts) - 2]) > section(pts, angles, i, 0.2, 0.01); > > > On Fri, Apr 9, 2021 at 7:21 AM <superaorta@gmail.com> wrote: > >> Scaling the model doesn't appear to fix anything >> >> >> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> >
S
superaorta@gmail.com
Fri, Apr 9, 2021 12:24 PM

That is an extremely nice solution (and also very fast).  I'd tried the
opposite using minkowski sum of an extremely thin path and a sphere but that
was horribly slow.

I can also see this will be intrinsically immune to the problems I've had so
far.

Thanks you! that is much appreciated!

On Friday, 9 April 2021 13:10:37 BST A. Craig West wrote:

Try this, it is more likely to get the results you need (all of those
spheres and cylinders of matching radius and position are far too likely to
cause degenerate polygons of various types)
// sm=0.000000
$fn=30;

pts = [
[0.000000,0,10.593750],
[0.000000,0,10.406250],
[-0.003906,0,10.199219],
[-0.011719,0,9.972656],
[-0.023438,0,9.726562],
[-0.039062,0,9.460938],
[-0.058594,0,9.175781],
[-0.082031,0,8.871094],
[-0.109375,0,8.546875],
[-0.140625,0,8.203125],
[-0.175781,0,7.839844],
[-0.214844,0,7.457031],
[-0.257812,0,7.054688],
[-0.304688,0,6.632812],
[-0.355469,0,6.191406],
[-0.410156,0,5.730469],
[-0.468750,0,5.250000],
[-0.531250,0,4.750000],
[-0.582031,0,4.273438],
[-0.621094,0,3.820312],
[-0.648438,0,3.390625],
[-0.664062,0,2.984375],
[-0.667969,0,2.601562],
[-0.660156,0,2.242188],
[-0.640625,0,1.906250],
[-0.609375,0,1.593750],
[-0.566406,0,1.304688],
[-0.511719,0,1.039062],
[-0.445312,0,0.796875],
[-0.367188,0,0.578125],
[-0.277344,0,0.382812],
[-0.175781,0,0.210938],
[-0.062500,0,0.062500],
[0, 0, 0]
];

angles = [
[0,180.000000,0],
[0,181.080924,0],
[0,181.974934,0],
[0,182.726311,0],
[0,183.366461,0],
[0,183.918249,0],
[0,184.398705,0],
[0,184.820766,0],
[0,185.194429,0],
[0,185.527540,0],
[0,185.826342,0],
[0,186.095862,0],
[0,186.340192,0],
[0,186.562699,0],
[0,186.766175,0],
[0,186.952957,0],
[0,187.125016,0],
[0,186.082337,0],
[0,184.927110,0],
[0,183.641185,0],
[0,182.202598,0],
[0,180.584631,0],
[0,178.754636,0],
[0,176.672596,0],
[0,174.289407,0],
[0,171.544972,0],
[0,168.366366,0],
[0,164.666715,0],
[0,160.346176,0],
[0,155.297570,0],
[0,149.420773,0],
[0,142.650651,0],
[0,135.000000,0],
[0,135.000000,0]
];

module section(pts, angles, i, r, t) {
hull() {
translate(pts[i])
rotate(angles[i])
cylinder(r = r, h = t, center = true);
translate(pts[i + 1])
rotate(angles[i + 1])
cylinder(r = r, h = t, center = true);
}
}

for (i = [0 : len(pts) - 2])
section(pts, angles, i, 0.2, 0.01);

On Fri, Apr 9, 2021 at 7:21 AM superaorta@gmail.com wrote:

Scaling the model doesn't appear to fix anything


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

That is an extremely nice solution (and also very fast). I'd tried the opposite using minkowski sum of an extremely thin path and a sphere but that was horribly slow. I can also see this will be intrinsically immune to the problems I've had so far. Thanks you! that is much appreciated! On Friday, 9 April 2021 13:10:37 BST A. Craig West wrote: > Try this, it is more likely to get the results you need (all of those > spheres and cylinders of matching radius and position are far too likely to > cause degenerate polygons of various types) > // sm=0.000000 > $fn=30; > > pts = [ > [0.000000,0,10.593750], > [0.000000,0,10.406250], > [-0.003906,0,10.199219], > [-0.011719,0,9.972656], > [-0.023438,0,9.726562], > [-0.039062,0,9.460938], > [-0.058594,0,9.175781], > [-0.082031,0,8.871094], > [-0.109375,0,8.546875], > [-0.140625,0,8.203125], > [-0.175781,0,7.839844], > [-0.214844,0,7.457031], > [-0.257812,0,7.054688], > [-0.304688,0,6.632812], > [-0.355469,0,6.191406], > [-0.410156,0,5.730469], > [-0.468750,0,5.250000], > [-0.531250,0,4.750000], > [-0.582031,0,4.273438], > [-0.621094,0,3.820312], > [-0.648438,0,3.390625], > [-0.664062,0,2.984375], > [-0.667969,0,2.601562], > [-0.660156,0,2.242188], > [-0.640625,0,1.906250], > [-0.609375,0,1.593750], > [-0.566406,0,1.304688], > [-0.511719,0,1.039062], > [-0.445312,0,0.796875], > [-0.367188,0,0.578125], > [-0.277344,0,0.382812], > [-0.175781,0,0.210938], > [-0.062500,0,0.062500], > [0, 0, 0] > ]; > > angles = [ > [0,180.000000,0], > [0,181.080924,0], > [0,181.974934,0], > [0,182.726311,0], > [0,183.366461,0], > [0,183.918249,0], > [0,184.398705,0], > [0,184.820766,0], > [0,185.194429,0], > [0,185.527540,0], > [0,185.826342,0], > [0,186.095862,0], > [0,186.340192,0], > [0,186.562699,0], > [0,186.766175,0], > [0,186.952957,0], > [0,187.125016,0], > [0,186.082337,0], > [0,184.927110,0], > [0,183.641185,0], > [0,182.202598,0], > [0,180.584631,0], > [0,178.754636,0], > [0,176.672596,0], > [0,174.289407,0], > [0,171.544972,0], > [0,168.366366,0], > [0,164.666715,0], > [0,160.346176,0], > [0,155.297570,0], > [0,149.420773,0], > [0,142.650651,0], > [0,135.000000,0], > [0,135.000000,0] > ]; > > module section(pts, angles, i, r, t) { > hull() { > translate(pts[i]) > rotate(angles[i]) > cylinder(r = r, h = t, center = true); > translate(pts[i + 1]) > rotate(angles[i + 1]) > cylinder(r = r, h = t, center = true); > } > } > > for (i = [0 : len(pts) - 2]) > section(pts, angles, i, 0.2, 0.01); > > On Fri, Apr 9, 2021 at 7:21 AM <superaorta@gmail.com> wrote: > > Scaling the model doesn't appear to fix anything > > > > > > > > _______________________________________________ > > OpenSCAD mailing list > > To unsubscribe send an email to discuss-leave@lists.openscad.org
AC
A. Craig West
Fri, Apr 9, 2021 12:32 PM

The biggest problem with using this for more general shapes is that it only
works for convex shapes. Luckily yours is a circle, which is as convex as
it gets. If you do need concave shapes, you can usually decompose it into
multiple convex shapes with difference and union

On Fri, 9 Apr 2021, 08:24 , superaorta@gmail.com wrote:

That is an extremely nice solution (and also very fast).  I'd tried the
opposite using minkowski sum of an extremely thin path and a sphere but
that
was horribly slow.

I can also see this will be intrinsically immune to the problems I've had
so
far.

Thanks you! that is much appreciated!

On Friday, 9 April 2021 13:10:37 BST A. Craig West wrote:

Try this, it is more likely to get the results you need (all of those
spheres and cylinders of matching radius and position are far too likely

to

cause degenerate polygons of various types)
// sm=0.000000
$fn=30;

pts = [
[0.000000,0,10.593750],
[0.000000,0,10.406250],
[-0.003906,0,10.199219],
[-0.011719,0,9.972656],
[-0.023438,0,9.726562],
[-0.039062,0,9.460938],
[-0.058594,0,9.175781],
[-0.082031,0,8.871094],
[-0.109375,0,8.546875],
[-0.140625,0,8.203125],
[-0.175781,0,7.839844],
[-0.214844,0,7.457031],
[-0.257812,0,7.054688],
[-0.304688,0,6.632812],
[-0.355469,0,6.191406],
[-0.410156,0,5.730469],
[-0.468750,0,5.250000],
[-0.531250,0,4.750000],
[-0.582031,0,4.273438],
[-0.621094,0,3.820312],
[-0.648438,0,3.390625],
[-0.664062,0,2.984375],
[-0.667969,0,2.601562],
[-0.660156,0,2.242188],
[-0.640625,0,1.906250],
[-0.609375,0,1.593750],
[-0.566406,0,1.304688],
[-0.511719,0,1.039062],
[-0.445312,0,0.796875],
[-0.367188,0,0.578125],
[-0.277344,0,0.382812],
[-0.175781,0,0.210938],
[-0.062500,0,0.062500],
[0, 0, 0]
];

angles = [
[0,180.000000,0],
[0,181.080924,0],
[0,181.974934,0],
[0,182.726311,0],
[0,183.366461,0],
[0,183.918249,0],
[0,184.398705,0],
[0,184.820766,0],
[0,185.194429,0],
[0,185.527540,0],
[0,185.826342,0],
[0,186.095862,0],
[0,186.340192,0],
[0,186.562699,0],
[0,186.766175,0],
[0,186.952957,0],
[0,187.125016,0],
[0,186.082337,0],
[0,184.927110,0],
[0,183.641185,0],
[0,182.202598,0],
[0,180.584631,0],
[0,178.754636,0],
[0,176.672596,0],
[0,174.289407,0],
[0,171.544972,0],
[0,168.366366,0],
[0,164.666715,0],
[0,160.346176,0],
[0,155.297570,0],
[0,149.420773,0],
[0,142.650651,0],
[0,135.000000,0],
[0,135.000000,0]
];

module section(pts, angles, i, r, t) {
hull() {
translate(pts[i])
rotate(angles[i])
cylinder(r = r, h = t, center = true);
translate(pts[i + 1])
rotate(angles[i + 1])
cylinder(r = r, h = t, center = true);
}
}

for (i = [0 : len(pts) - 2])
section(pts, angles, i, 0.2, 0.01);

On Fri, Apr 9, 2021 at 7:21 AM superaorta@gmail.com wrote:

Scaling the model doesn't appear to fix anything


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

The biggest problem with using this for more general shapes is that it only works for convex shapes. Luckily yours is a circle, which is as convex as it gets. If you do need concave shapes, you can usually decompose it into multiple convex shapes with difference and union On Fri, 9 Apr 2021, 08:24 , <superaorta@gmail.com> wrote: > > That is an extremely nice solution (and also very fast). I'd tried the > opposite using minkowski sum of an extremely thin path and a sphere but > that > was horribly slow. > > I can also see this will be intrinsically immune to the problems I've had > so > far. > > Thanks you! that is much appreciated! > > > > > > > > > > > On Friday, 9 April 2021 13:10:37 BST A. Craig West wrote: > > Try this, it is more likely to get the results you need (all of those > > spheres and cylinders of matching radius and position are far too likely > to > > cause degenerate polygons of various types) > > // sm=0.000000 > > $fn=30; > > > > pts = [ > > [0.000000,0,10.593750], > > [0.000000,0,10.406250], > > [-0.003906,0,10.199219], > > [-0.011719,0,9.972656], > > [-0.023438,0,9.726562], > > [-0.039062,0,9.460938], > > [-0.058594,0,9.175781], > > [-0.082031,0,8.871094], > > [-0.109375,0,8.546875], > > [-0.140625,0,8.203125], > > [-0.175781,0,7.839844], > > [-0.214844,0,7.457031], > > [-0.257812,0,7.054688], > > [-0.304688,0,6.632812], > > [-0.355469,0,6.191406], > > [-0.410156,0,5.730469], > > [-0.468750,0,5.250000], > > [-0.531250,0,4.750000], > > [-0.582031,0,4.273438], > > [-0.621094,0,3.820312], > > [-0.648438,0,3.390625], > > [-0.664062,0,2.984375], > > [-0.667969,0,2.601562], > > [-0.660156,0,2.242188], > > [-0.640625,0,1.906250], > > [-0.609375,0,1.593750], > > [-0.566406,0,1.304688], > > [-0.511719,0,1.039062], > > [-0.445312,0,0.796875], > > [-0.367188,0,0.578125], > > [-0.277344,0,0.382812], > > [-0.175781,0,0.210938], > > [-0.062500,0,0.062500], > > [0, 0, 0] > > ]; > > > > angles = [ > > [0,180.000000,0], > > [0,181.080924,0], > > [0,181.974934,0], > > [0,182.726311,0], > > [0,183.366461,0], > > [0,183.918249,0], > > [0,184.398705,0], > > [0,184.820766,0], > > [0,185.194429,0], > > [0,185.527540,0], > > [0,185.826342,0], > > [0,186.095862,0], > > [0,186.340192,0], > > [0,186.562699,0], > > [0,186.766175,0], > > [0,186.952957,0], > > [0,187.125016,0], > > [0,186.082337,0], > > [0,184.927110,0], > > [0,183.641185,0], > > [0,182.202598,0], > > [0,180.584631,0], > > [0,178.754636,0], > > [0,176.672596,0], > > [0,174.289407,0], > > [0,171.544972,0], > > [0,168.366366,0], > > [0,164.666715,0], > > [0,160.346176,0], > > [0,155.297570,0], > > [0,149.420773,0], > > [0,142.650651,0], > > [0,135.000000,0], > > [0,135.000000,0] > > ]; > > > > module section(pts, angles, i, r, t) { > > hull() { > > translate(pts[i]) > > rotate(angles[i]) > > cylinder(r = r, h = t, center = true); > > translate(pts[i + 1]) > > rotate(angles[i + 1]) > > cylinder(r = r, h = t, center = true); > > } > > } > > > > for (i = [0 : len(pts) - 2]) > > section(pts, angles, i, 0.2, 0.01); > > > > On Fri, Apr 9, 2021 at 7:21 AM <superaorta@gmail.com> wrote: > > > Scaling the model doesn't appear to fix anything > > > > > > > > > > > > _______________________________________________ > > > 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 >
A
adrianv
Fri, Apr 9, 2021 12:45 PM

I tried the polyhedron approach and 1 copy of the object rendered instantly
and 3 copies of the object rendered in 7s.  With the approach below, it took
30s to render one copy of the object and 43s to render 3 copies.  Probably
lazy union would help the performance of the hull approach significantly.

The easiest way to use the polyhedron approach is to use a sweep function to
make your polyhedron.  The one I used is from the BOSL2 library.

https://github.com/revarbat/BOSL2/wiki/skin.scad#functionmodule-path_sweep

Other libraries such as dotSCAD also supply this capability.

include<BOSL2/std.scad>
$fn=30;

pts = [
[0.000000,0,10.593750],
[0.000000,0,10.406250],
[-0.003906,0,10.199219],
[-0.011719,0,9.972656],
[-0.023438,0,9.726562],
[-0.039062,0,9.460938],
[-0.058594,0,9.175781],
[-0.082031,0,8.871094],
[-0.109375,0,8.546875],
[-0.140625,0,8.203125],
[-0.175781,0,7.839844],
[-0.214844,0,7.457031],
[-0.257812,0,7.054688],
[-0.304688,0,6.632812],
[-0.355469,0,6.191406],
[-0.410156,0,5.730469],
[-0.468750,0,5.250000],
[-0.531250,0,4.750000],
[-0.582031,0,4.273438],
[-0.621094,0,3.820312],
[-0.648438,0,3.390625],
[-0.664062,0,2.984375],
[-0.667969,0,2.601562],
[-0.660156,0,2.242188],
[-0.640625,0,1.906250],
[-0.609375,0,1.593750],
[-0.566406,0,1.304688],
[-0.511719,0,1.039062],
[-0.445312,0,0.796875],
[-0.367188,0,0.578125],
[-0.277344,0,0.382812],
[-0.175781,0,0.210938],
[-0.062500,0,0.062500],
];

path_sweep(circle(r=.2), pts);

acwest wrote

I should note that it might be more efficient to build this as a
polyhedron, but the hull solution works pretty well in this example

On Fri, Apr 9, 2021 at 8:10 AM A. Craig West <

acraigwest@

> wrote:

Try this, it is more likely to get the results you need (all of those
spheres and cylinders of matching radius and position are far too likely
to
cause degenerate polygons of various types)
// sm=0.000000
$fn=30;

pts = [
[0.000000,0,10.593750],
[0.000000,0,10.406250],
[-0.003906,0,10.199219],
[-0.011719,0,9.972656],
[-0.023438,0,9.726562],
[-0.039062,0,9.460938],
[-0.058594,0,9.175781],
[-0.082031,0,8.871094],
[-0.109375,0,8.546875],
[-0.140625,0,8.203125],
[-0.175781,0,7.839844],
[-0.214844,0,7.457031],
[-0.257812,0,7.054688],
[-0.304688,0,6.632812],
[-0.355469,0,6.191406],
[-0.410156,0,5.730469],
[-0.468750,0,5.250000],
[-0.531250,0,4.750000],
[-0.582031,0,4.273438],
[-0.621094,0,3.820312],
[-0.648438,0,3.390625],
[-0.664062,0,2.984375],
[-0.667969,0,2.601562],
[-0.660156,0,2.242188],
[-0.640625,0,1.906250],
[-0.609375,0,1.593750],
[-0.566406,0,1.304688],
[-0.511719,0,1.039062],
[-0.445312,0,0.796875],
[-0.367188,0,0.578125],
[-0.277344,0,0.382812],
[-0.175781,0,0.210938],
[-0.062500,0,0.062500],
[0, 0, 0]
];

angles = [
[0,180.000000,0],
[0,181.080924,0],
[0,181.974934,0],
[0,182.726311,0],
[0,183.366461,0],
[0,183.918249,0],
[0,184.398705,0],
[0,184.820766,0],
[0,185.194429,0],
[0,185.527540,0],
[0,185.826342,0],
[0,186.095862,0],
[0,186.340192,0],
[0,186.562699,0],
[0,186.766175,0],
[0,186.952957,0],
[0,187.125016,0],
[0,186.082337,0],
[0,184.927110,0],
[0,183.641185,0],
[0,182.202598,0],
[0,180.584631,0],
[0,178.754636,0],
[0,176.672596,0],
[0,174.289407,0],
[0,171.544972,0],
[0,168.366366,0],
[0,164.666715,0],
[0,160.346176,0],
[0,155.297570,0],
[0,149.420773,0],
[0,142.650651,0],
[0,135.000000,0],
[0,135.000000,0]
];

module section(pts, angles, i, r, t) {
hull() {
translate(pts[i])
rotate(angles[i])
cylinder(r = r, h = t, center = true);
translate(pts[i + 1])
rotate(angles[i + 1])
cylinder(r = r, h = t, center = true);
}
}

for (i = [0 : len(pts) - 2])
section(pts, angles, i, 0.2, 0.01);

On Fri, Apr 9, 2021 at 7:21 AM <

superaorta@

> wrote:

Scaling the model doesn't appear to fix anything


OpenSCAD mailing list
To unsubscribe send an email to

discuss-leave@.openscad


OpenSCAD mailing list
To unsubscribe send an email to

discuss-leave@.openscad

I tried the polyhedron approach and 1 copy of the object rendered instantly and 3 copies of the object rendered in 7s. With the approach below, it took 30s to render one copy of the object and 43s to render 3 copies. Probably lazy union would help the performance of the hull approach significantly. The easiest way to use the polyhedron approach is to use a sweep function to make your polyhedron. The one I used is from the BOSL2 library. https://github.com/revarbat/BOSL2/wiki/skin.scad#functionmodule-path_sweep Other libraries such as dotSCAD also supply this capability. include<BOSL2/std.scad> $fn=30; pts = [ [0.000000,0,10.593750], [0.000000,0,10.406250], [-0.003906,0,10.199219], [-0.011719,0,9.972656], [-0.023438,0,9.726562], [-0.039062,0,9.460938], [-0.058594,0,9.175781], [-0.082031,0,8.871094], [-0.109375,0,8.546875], [-0.140625,0,8.203125], [-0.175781,0,7.839844], [-0.214844,0,7.457031], [-0.257812,0,7.054688], [-0.304688,0,6.632812], [-0.355469,0,6.191406], [-0.410156,0,5.730469], [-0.468750,0,5.250000], [-0.531250,0,4.750000], [-0.582031,0,4.273438], [-0.621094,0,3.820312], [-0.648438,0,3.390625], [-0.664062,0,2.984375], [-0.667969,0,2.601562], [-0.660156,0,2.242188], [-0.640625,0,1.906250], [-0.609375,0,1.593750], [-0.566406,0,1.304688], [-0.511719,0,1.039062], [-0.445312,0,0.796875], [-0.367188,0,0.578125], [-0.277344,0,0.382812], [-0.175781,0,0.210938], [-0.062500,0,0.062500], ]; path_sweep(circle(r=.2), pts); acwest wrote > I should note that it might be more efficient to build this as a > polyhedron, but the hull solution works pretty well in this example > > On Fri, Apr 9, 2021 at 8:10 AM A. Craig West &lt; > acraigwest@ > &gt; wrote: > >> Try this, it is more likely to get the results you need (all of those >> spheres and cylinders of matching radius and position are far too likely >> to >> cause degenerate polygons of various types) >> // sm=0.000000 >> $fn=30; >> >> pts = [ >> [0.000000,0,10.593750], >> [0.000000,0,10.406250], >> [-0.003906,0,10.199219], >> [-0.011719,0,9.972656], >> [-0.023438,0,9.726562], >> [-0.039062,0,9.460938], >> [-0.058594,0,9.175781], >> [-0.082031,0,8.871094], >> [-0.109375,0,8.546875], >> [-0.140625,0,8.203125], >> [-0.175781,0,7.839844], >> [-0.214844,0,7.457031], >> [-0.257812,0,7.054688], >> [-0.304688,0,6.632812], >> [-0.355469,0,6.191406], >> [-0.410156,0,5.730469], >> [-0.468750,0,5.250000], >> [-0.531250,0,4.750000], >> [-0.582031,0,4.273438], >> [-0.621094,0,3.820312], >> [-0.648438,0,3.390625], >> [-0.664062,0,2.984375], >> [-0.667969,0,2.601562], >> [-0.660156,0,2.242188], >> [-0.640625,0,1.906250], >> [-0.609375,0,1.593750], >> [-0.566406,0,1.304688], >> [-0.511719,0,1.039062], >> [-0.445312,0,0.796875], >> [-0.367188,0,0.578125], >> [-0.277344,0,0.382812], >> [-0.175781,0,0.210938], >> [-0.062500,0,0.062500], >> [0, 0, 0] >> ]; >> >> angles = [ >> [0,180.000000,0], >> [0,181.080924,0], >> [0,181.974934,0], >> [0,182.726311,0], >> [0,183.366461,0], >> [0,183.918249,0], >> [0,184.398705,0], >> [0,184.820766,0], >> [0,185.194429,0], >> [0,185.527540,0], >> [0,185.826342,0], >> [0,186.095862,0], >> [0,186.340192,0], >> [0,186.562699,0], >> [0,186.766175,0], >> [0,186.952957,0], >> [0,187.125016,0], >> [0,186.082337,0], >> [0,184.927110,0], >> [0,183.641185,0], >> [0,182.202598,0], >> [0,180.584631,0], >> [0,178.754636,0], >> [0,176.672596,0], >> [0,174.289407,0], >> [0,171.544972,0], >> [0,168.366366,0], >> [0,164.666715,0], >> [0,160.346176,0], >> [0,155.297570,0], >> [0,149.420773,0], >> [0,142.650651,0], >> [0,135.000000,0], >> [0,135.000000,0] >> ]; >> >> module section(pts, angles, i, r, t) { >> hull() { >> translate(pts[i]) >> rotate(angles[i]) >> cylinder(r = r, h = t, center = true); >> translate(pts[i + 1]) >> rotate(angles[i + 1]) >> cylinder(r = r, h = t, center = true); >> } >> } >> >> for (i = [0 : len(pts) - 2]) >> section(pts, angles, i, 0.2, 0.01); >> >> >> On Fri, Apr 9, 2021 at 7:21 AM &lt; > superaorta@ > &gt; wrote: >> >>> Scaling the model doesn't appear to fix anything >>> >>> >>> >>> _______________________________________________ >>> OpenSCAD mailing list >>> To unsubscribe send an email to > discuss-leave@.openscad >>> >> > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to > discuss-leave@.openscad -- Sent from: http://forum.openscad.org/
AC
A. Craig West
Fri, Apr 9, 2021 12:53 PM

I was pretty sure that was the case. I wrote my own functions to do sweep
style functionality based on beziers, for generating the cooling ducts for
Hero Me in recent versions. At the time I had not found BOSL 2, and my
libraries are rather extensive now. I need to look at what is there, and
perhaps add any functionality I have that is not in BOSL2 yet.
It is amazing how difficult it was to properly implement triangularisation
of arbitrary polygons in 2d, I'm pretty sure I could have saved myself a
lot of work. On the other hand, I quite enjoyed it 😁

On Fri, 9 Apr 2021, 08:45 adrianv, avm4@cornell.edu wrote:

I tried the polyhedron approach and 1 copy of the object rendered
instantly and 3 copies of the object rendered in 7s.  With the approach
below, it took 30s to render one copy of the object and 43s to render 3
copies.  Probably lazy union would help the performance of the hull
approach significantly.

The easiest way to use the polyhedron approach is to use a sweep function
to make your polyhedron.  The one I used is from the BOSL2 library.

https://github.com/revarbat/BOSL2/wiki/skin.scad#functionmodule-path_sweep

Other libraries such as dotSCAD also supply this capability.

include<BOSL2/std.scad>
$fn=30;

pts = [
[0.000000,0,10.593750],
[0.000000,0,10.406250],
[-0.003906,0,10.199219],
[-0.011719,0,9.972656],
[-0.023438,0,9.726562],
[-0.039062,0,9.460938],
[-0.058594,0,9.175781],
[-0.082031,0,8.871094],
[-0.109375,0,8.546875],
[-0.140625,0,8.203125],
[-0.175781,0,7.839844],
[-0.214844,0,7.457031],
[-0.257812,0,7.054688],
[-0.304688,0,6.632812],
[-0.355469,0,6.191406],
[-0.410156,0,5.730469],
[-0.468750,0,5.250000],
[-0.531250,0,4.750000],
[-0.582031,0,4.273438],
[-0.621094,0,3.820312],
[-0.648438,0,3.390625],
[-0.664062,0,2.984375],
[-0.667969,0,2.601562],
[-0.660156,0,2.242188],
[-0.640625,0,1.906250],
[-0.609375,0,1.593750],
[-0.566406,0,1.304688],
[-0.511719,0,1.039062],
[-0.445312,0,0.796875],
[-0.367188,0,0.578125],
[-0.277344,0,0.382812],
[-0.175781,0,0.210938],
[-0.062500,0,0.062500],
];

path_sweep(circle(r=.2), pts);

acwest wrote
I should note that it might be more efficient to build this as a
polyhedron, but the hull solution works pretty well in this example

On Fri, Apr 9, 2021 at 8:10 AM A. Craig West <[hidden email]
http:///user/SendEmail.jtp?type=email&email=acraigwest%40> wrote:

Try this, it is more likely to get the results you need (all of those
spheres and cylinders of matching radius and position are far too likely

to

cause degenerate polygons of various types)
// sm=0.000000
$fn=30;

pts = [
[0.000000,0,10.593750],
[0.000000,0,10.406250],
[-0.003906,0,10.199219],
[-0.011719,0,9.972656],
[-0.023438,0,9.726562],
[-0.039062,0,9.460938],
[-0.058594,0,9.175781],
[-0.082031,0,8.871094],
[-0.109375,0,8.546875],
[-0.140625,0,8.203125],
[-0.175781,0,7.839844],
[-0.214844,0,7.457031],
[-0.257812,0,7.054688],
[-0.304688,0,6.632812],
[-0.355469,0,6.191406],
[-0.410156,0,5.730469],
[-0.468750,0,5.250000],
[-0.531250,0,4.750000],
[-0.582031,0,4.273438],
[-0.621094,0,3.820312],
[-0.648438,0,3.390625],
[-0.664062,0,2.984375],
[-0.667969,0,2.601562],
[-0.660156,0,2.242188],
[-0.640625,0,1.906250],
[-0.609375,0,1.593750],
[-0.566406,0,1.304688],
[-0.511719,0,1.039062],
[-0.445312,0,0.796875],
[-0.367188,0,0.578125],
[-0.277344,0,0.382812],
[-0.175781,0,0.210938],
[-0.062500,0,0.062500],
[0, 0, 0]
];

angles = [
[0,180.000000,0],
[0,181.080924,0],
[0,181.974934,0],
[0,182.726311,0],
[0,183.366461,0],
[0,183.918249,0],
[0,184.398705,0],
[0,184.820766,0],
[0,185.194429,0],
[0,185.527540,0],
[0,185.826342,0],
[0,186.095862,0],
[0,186.340192,0],
[0,186.562699,0],
[0,186.766175,0],
[0,186.952957,0],
[0,187.125016,0],
[0,186.082337,0],
[0,184.927110,0],
[0,183.641185,0],
[0,182.202598,0],
[0,180.584631,0],
[0,178.754636,0],
[0,176.672596,0],
[0,174.289407,0],
[0,171.544972,0],
[0,168.366366,0],
[0,164.666715,0],
[0,160.346176,0],
[0,155.297570,0],
[0,149.420773,0],
[0,142.650651,0],
[0,135.000000,0],
[0,135.000000,0]
];

module section(pts, angles, i, r, t) {
hull() {
translate(pts[i])
rotate(angles[i])
cylinder(r = r, h = t, center = true);
translate(pts[i + 1])
rotate(angles[i + 1])
cylinder(r = r, h = t, center = true);
}
}

for (i = [0 : len(pts) - 2])
section(pts, angles, i, 0.2, 0.01);

On Fri, Apr 9, 2021 at 7:21 AM <[hidden email]

Scaling the model doesn't appear to fix anything


OpenSCAD mailing list
To unsubscribe send an email to [hidden email]


OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
http:///user/SendEmail.jtp?type=email&email=discuss-leave%40.openscad


Sent from the OpenSCAD mailing list archive http://forum.openscad.org/
at Nabble.com.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

I was pretty sure that was the case. I wrote my own functions to do sweep style functionality based on beziers, for generating the cooling ducts for Hero Me in recent versions. At the time I had not found BOSL 2, and my libraries are rather extensive now. I need to look at what is there, and perhaps add any functionality I have that is not in BOSL2 yet. It is amazing how difficult it was to properly implement triangularisation of arbitrary polygons in 2d, I'm pretty sure I could have saved myself a lot of work. On the other hand, I quite enjoyed it 😁 On Fri, 9 Apr 2021, 08:45 adrianv, <avm4@cornell.edu> wrote: > I tried the polyhedron approach and 1 copy of the object rendered > instantly and 3 copies of the object rendered in 7s. With the approach > below, it took 30s to render one copy of the object and 43s to render 3 > copies. Probably lazy union would help the performance of the hull > approach significantly. > > The easiest way to use the polyhedron approach is to use a sweep function > to make your polyhedron. The one I used is from the BOSL2 library. > > https://github.com/revarbat/BOSL2/wiki/skin.scad#functionmodule-path_sweep > > Other libraries such as dotSCAD also supply this capability. > > include<BOSL2/std.scad> > $fn=30; > > pts = [ > [0.000000,0,10.593750], > [0.000000,0,10.406250], > [-0.003906,0,10.199219], > [-0.011719,0,9.972656], > [-0.023438,0,9.726562], > [-0.039062,0,9.460938], > [-0.058594,0,9.175781], > [-0.082031,0,8.871094], > [-0.109375,0,8.546875], > [-0.140625,0,8.203125], > [-0.175781,0,7.839844], > [-0.214844,0,7.457031], > [-0.257812,0,7.054688], > [-0.304688,0,6.632812], > [-0.355469,0,6.191406], > [-0.410156,0,5.730469], > [-0.468750,0,5.250000], > [-0.531250,0,4.750000], > [-0.582031,0,4.273438], > [-0.621094,0,3.820312], > [-0.648438,0,3.390625], > [-0.664062,0,2.984375], > [-0.667969,0,2.601562], > [-0.660156,0,2.242188], > [-0.640625,0,1.906250], > [-0.609375,0,1.593750], > [-0.566406,0,1.304688], > [-0.511719,0,1.039062], > [-0.445312,0,0.796875], > [-0.367188,0,0.578125], > [-0.277344,0,0.382812], > [-0.175781,0,0.210938], > [-0.062500,0,0.062500], > ]; > > path_sweep(circle(r=.2), pts); > > acwest wrote > I should note that it might be more efficient to build this as a > polyhedron, but the hull solution works pretty well in this example > > On Fri, Apr 9, 2021 at 8:10 AM A. Craig West <[hidden email] > <http:///user/SendEmail.jtp?type=email&email=acraigwest%40>> wrote: > > > Try this, it is more likely to get the results you need (all of those > > spheres and cylinders of matching radius and position are far too likely > to > > cause degenerate polygons of various types) > > // sm=0.000000 > > $fn=30; > > > > pts = [ > > [0.000000,0,10.593750], > > [0.000000,0,10.406250], > > [-0.003906,0,10.199219], > > [-0.011719,0,9.972656], > > [-0.023438,0,9.726562], > > [-0.039062,0,9.460938], > > [-0.058594,0,9.175781], > > [-0.082031,0,8.871094], > > [-0.109375,0,8.546875], > > [-0.140625,0,8.203125], > > [-0.175781,0,7.839844], > > [-0.214844,0,7.457031], > > [-0.257812,0,7.054688], > > [-0.304688,0,6.632812], > > [-0.355469,0,6.191406], > > [-0.410156,0,5.730469], > > [-0.468750,0,5.250000], > > [-0.531250,0,4.750000], > > [-0.582031,0,4.273438], > > [-0.621094,0,3.820312], > > [-0.648438,0,3.390625], > > [-0.664062,0,2.984375], > > [-0.667969,0,2.601562], > > [-0.660156,0,2.242188], > > [-0.640625,0,1.906250], > > [-0.609375,0,1.593750], > > [-0.566406,0,1.304688], > > [-0.511719,0,1.039062], > > [-0.445312,0,0.796875], > > [-0.367188,0,0.578125], > > [-0.277344,0,0.382812], > > [-0.175781,0,0.210938], > > [-0.062500,0,0.062500], > > [0, 0, 0] > > ]; > > > > angles = [ > > [0,180.000000,0], > > [0,181.080924,0], > > [0,181.974934,0], > > [0,182.726311,0], > > [0,183.366461,0], > > [0,183.918249,0], > > [0,184.398705,0], > > [0,184.820766,0], > > [0,185.194429,0], > > [0,185.527540,0], > > [0,185.826342,0], > > [0,186.095862,0], > > [0,186.340192,0], > > [0,186.562699,0], > > [0,186.766175,0], > > [0,186.952957,0], > > [0,187.125016,0], > > [0,186.082337,0], > > [0,184.927110,0], > > [0,183.641185,0], > > [0,182.202598,0], > > [0,180.584631,0], > > [0,178.754636,0], > > [0,176.672596,0], > > [0,174.289407,0], > > [0,171.544972,0], > > [0,168.366366,0], > > [0,164.666715,0], > > [0,160.346176,0], > > [0,155.297570,0], > > [0,149.420773,0], > > [0,142.650651,0], > > [0,135.000000,0], > > [0,135.000000,0] > > ]; > > > > module section(pts, angles, i, r, t) { > > hull() { > > translate(pts[i]) > > rotate(angles[i]) > > cylinder(r = r, h = t, center = true); > > translate(pts[i + 1]) > > rotate(angles[i + 1]) > > cylinder(r = r, h = t, center = true); > > } > > } > > > > for (i = [0 : len(pts) - 2]) > > section(pts, angles, i, 0.2, 0.01); > > > > > > On Fri, Apr 9, 2021 at 7:21 AM <[hidden email] > <http:///user/SendEmail.jtp?type=email&email=superaorta%40>> wrote: > > > >> Scaling the model doesn't appear to fix anything > >> > >> > >> > >> _______________________________________________ > >> OpenSCAD mailing list > >> To unsubscribe send an email to [hidden email] > <http:///user/SendEmail.jtp?type=email&email=discuss-leave%40.openscad> > >> > > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to [hidden email] > <http:///user/SendEmail.jtp?type=email&email=discuss-leave%40.openscad> > > > ------------------------------ > Sent from the OpenSCAD mailing list archive <http://forum.openscad.org/> > at Nabble.com. > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
CA
Carsten Arnholm
Fri, Apr 9, 2021 1:20 PM

On 09.04.2021 09:46, superaorta@gmail.com wrote:

STL enclosed and these highlight the problem:

// preview and render OK
translate([0,10,0])rotate([0,0,90])import("test.stl");
//translate([0,-10,0])rotate([0,0,90])import("test.stl");
//translate([0,0,-20])cylinder(r=12.5,h=10,$fn=120);


// preview OK and render fail
translate([0,10,0])rotate([0,0,90])import("test.stl");
translate([0,-10,0])rotate([0,0,90])import("test.stl");
//translate([0,0,-20])cylinder(r=12.5,h=10,$fn=120);


// preview OK and render fail
translate([0,10,0])rotate([0,0,90])import("test.stl");
//translate([0,-10,0])rotate([0,0,90])import("test.stl");
translate([0,0,-20])cylinder(r=12.5,h=10,$fn=120);

I should also mention I'm using V2019.05

Thanks!

Each of the 3 examples seem to work fine processing the .scad file in
AngelCAD, using the provided test.stl file.

In this process, the STL is automatically repaired using 'polyfix'. It
removes a large number of zero area faces and other issues. It still has
issues after repair, but the import works.

Carsten Arnholm

On 09.04.2021 09:46, superaorta@gmail.com wrote: > STL enclosed and these highlight the problem: > > // preview and render OK > translate([0,10,0])rotate([0,0,90])import("test.stl"); > //translate([0,-10,0])rotate([0,0,90])import("test.stl"); > //translate([0,0,-20])cylinder(r=12.5,h=10,$fn=120); > > ---- > > // preview OK and render fail > translate([0,10,0])rotate([0,0,90])import("test.stl"); > translate([0,-10,0])rotate([0,0,90])import("test.stl"); > //translate([0,0,-20])cylinder(r=12.5,h=10,$fn=120); > > ---- > > // preview OK and render fail > translate([0,10,0])rotate([0,0,90])import("test.stl"); > //translate([0,-10,0])rotate([0,0,90])import("test.stl"); > translate([0,0,-20])cylinder(r=12.5,h=10,$fn=120); > > I should also mention I'm using V2019.05 > > Thanks! Each of the 3 examples seem to work fine processing the .scad file in AngelCAD, using the provided test.stl file. In this process, the STL is automatically repaired using 'polyfix'. It removes a large number of zero area faces and other issues. It still has issues after repair, but the import works. Carsten Arnholm
CA
Carsten Arnholm
Fri, Apr 9, 2021 2:04 PM

On 09.04.2021 14:45, adrianv wrote:

I tried the polyhedron approach and 1 copy of the object rendered
instantly and 3 copies of the object rendered in 7s.  With the approach
below, it took 30s to render one copy of the object and 43s to render 3
copies.  Probably lazy union would help the performance of the hull
approach significantly.

The easiest way to use the polyhedron approach is to use a sweep
function to make your polyhedron.  The one I used is from the BOSL2
library.

https://github.com/revarbat/BOSL2/wiki/skin.scad#functionmodule-path_sweep

Other libraries such as dotSCAD also supply this capability.

Agreed, sweep is almost always the cleanest and most proper approach for
something like this. Sweep avoids the issues of mismatching sections and
performing a lot of unions, so it is much faster. And as a bonus you
don't have the issues resulting from the unions of slightly mismatching
sections.

https://gist.github.com/arnholm/87ccd342abc8b8bef712791f648b5021
This approach completes in 0.2s

Carsten Arnholm

On 09.04.2021 14:45, adrianv wrote: > I tried the polyhedron approach and 1 copy of the object rendered > instantly and 3 copies of the object rendered in 7s.  With the approach > below, it took 30s to render one copy of the object and 43s to render 3 > copies.  Probably lazy union would help the performance of the hull > approach significantly. > > The easiest way to use the polyhedron approach is to use a sweep > function to make your polyhedron.  The one I used is from the BOSL2 > library. > > https://github.com/revarbat/BOSL2/wiki/skin.scad#functionmodule-path_sweep > > Other libraries such as dotSCAD also supply this capability. Agreed, sweep is almost always the cleanest and most proper approach for something like this. Sweep avoids the issues of mismatching sections and performing a lot of unions, so it is much faster. And as a bonus you don't have the issues resulting from the unions of slightly mismatching sections. https://gist.github.com/arnholm/87ccd342abc8b8bef712791f648b5021 This approach completes in 0.2s Carsten Arnholm
S
superaorta@gmail.com
Fri, Apr 9, 2021 2:12 PM

Folks,

Thanks so much for your help.

I've implemented both the hull() and the sweep() methods and both work but the
sweep is fastest.  I'd never seen this library before but it does <exactly>
what I wanted.

One final question: my final model has many (100s) repeats of this simple
shape and, even with the sweep() method the final render is very slow (how
slow I don't know yet but the memory requirements seem sane).

At the moment I'm saving my shape to .stl and then tiling this .stl file.
Perhaps with the sweep() function I should skip this step? Clearly I need to
benchmark both approaches but while I wait for the final render would anyone
care to guess which would be faster?

Thanks!

Folks, Thanks so much for your help. I've implemented both the hull() and the sweep() methods and both work but the sweep is fastest. I'd never seen this library before but it does <exactly> what I wanted. One final question: my final model has many (100s) repeats of this simple shape and, even with the sweep() method the final render is very slow (how slow I don't know yet but the memory requirements seem sane). At the moment I'm saving my shape to .stl and then tiling this .stl file. Perhaps with the sweep() function I should skip this step? Clearly I need to benchmark both approaches but while I wait for the final render would anyone care to guess which would be faster? Thanks!
NH
nop head
Fri, Apr 9, 2021 2:31 PM

My guess would be both methods would be about the same because the time is
taken unioning the items together.

On Fri, 9 Apr 2021 at 15:12, superaorta@gmail.com wrote:

Folks,

Thanks so much for your help.

I've implemented both the hull() and the sweep() methods and both work but
the
sweep is fastest.  I'd never seen this library before but it does
<exactly>
what I wanted.

One final question: my final model has many (100s) repeats of this simple
shape and, even with the sweep() method the final render is very slow (how
slow I don't know yet but the memory requirements seem sane).

At the moment I'm saving my shape to .stl and then tiling this .stl file.
Perhaps with the sweep() function I should skip this step? Clearly I need
to
benchmark both approaches but while I wait for the final render would
anyone
care to guess which would be faster?

Thanks!


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

My guess would be both methods would be about the same because the time is taken unioning the items together. On Fri, 9 Apr 2021 at 15:12, <superaorta@gmail.com> wrote: > Folks, > > Thanks so much for your help. > > I've implemented both the hull() and the sweep() methods and both work but > the > sweep is fastest. I'd never seen this library before but it does > <exactly> > what I wanted. > > One final question: my final model has many (100s) repeats of this simple > shape and, even with the sweep() method the final render is very slow (how > slow I don't know yet but the memory requirements seem sane). > > At the moment I'm saving my shape to .stl and then tiling this .stl file. > Perhaps with the sweep() function I should skip this step? Clearly I need > to > benchmark both approaches but while I wait for the final render would > anyone > care to guess which would be faster? > > Thanks! > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
JB
Jordan Brown
Fri, Apr 9, 2021 4:03 PM

On 4/9/2021 12:09 AM, superaorta@gmail.com wrote:

I can render the one part quickly but rendering the many copies is
proving impossible.

I'm looking for simple ways to divide and conquer the problem.

My approach is to generate the basic part and save to stl (easily
doable and takes a few seconds) and then I generate my array using
import("part.stl").

Somebody who knows more about the geometry processing than I do can
correct me if I'm wrong, but I don't think this approach can help with
the rendering time, even if you get past the CGAL issues.

You say that rendering one of your object is fast, but that rendering
more than one is slow.

The slowness comes from the boolean operations required.  Exporting to
STL and importing the STL only saves the time to render the original
object; it doesn't save the time required to do the boolean operations.

Put differently:  if it takes insignificant time to render the
individual objects... then they aren't the problem.  Once they're
rendered to STL and you re-import the STL, you're in exactly the same
place you would have been, doing expensive boolean operations on pretty
much the same objects.

(Not quite exactly the same objects.  STL converts to triangles.  That
might actually make it worse, because you can have several times as many
of them as you had facets in the original objects.)

Theoretically you might get something of a win by exporting to STL and
then doing the boolean operations in parallel with multiple invocations
of OpenSCAD.  However, because the last boolean operation, which can't
be in parallel, tends to be the most expensive, the win will not be as
big as you'd like.


But I agree with Craig and Adrian:  trying to do this by connecting
cylinders and spheres will lead to pain, because you can't get the
facets on the spheres to precisely align with the facets on the
cylinders.  A sweep is a better answer.

On 4/9/2021 12:09 AM, superaorta@gmail.com wrote: > I can render the one part quickly but rendering the many copies is > proving impossible. > > I'm looking for simple ways to divide and conquer the problem. > > My approach is to generate the basic part and save to stl (easily > doable and takes a few seconds) and then I generate my array using > import("part.stl"). > Somebody who knows more about the geometry processing than I do can correct me if I'm wrong, but I don't think this approach can help with the rendering time, even if you get past the CGAL issues. You say that rendering one of your object is fast, but that rendering more than one is slow. The slowness comes from the boolean operations required.  Exporting to STL and importing the STL only saves the time to render the original object; it doesn't save the time required to do the boolean operations. Put differently:  if it takes insignificant time to render the individual objects... then they aren't the problem.  Once they're rendered to STL and you re-import the STL, you're in exactly the same place you would have been, doing expensive boolean operations on pretty much the same objects. (Not quite exactly the same objects.  STL converts to triangles.  That might actually make it worse, because you can have several times as many of them as you had facets in the original objects.) Theoretically you might get something of a win by exporting to STL and then doing the boolean operations in parallel with multiple invocations of OpenSCAD.  However, because the last boolean operation, which can't be in parallel, tends to be the most expensive, the win will not be as big as you'd like. --- But I agree with Craig and Adrian:  trying to do this by connecting cylinders and spheres will lead to pain, because you can't get the facets on the spheres to precisely align with the facets on the cylinders.  A sweep is a better answer.