Nabble removed Mailing-list integration from the Forum.
This killed the Forum. This is now an ARCHIVE.
It is likely Nabble will shutdown in the future.

So basically the Forum is now out of date, we are looking into migrating the history.

OpenSCAD support is now provided by the Mailing List.
See the first pinned post here for instructions on subscribing to the mailing list.

Complex model - reducing render time

classic Classic list List threaded Threaded
26 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Complex model - reducing render time

sasa
I've a model that takes ~1s to preview but I cannot render as it requires
>>32Gb RAM.

It consists of one part which is made of lots of intersecting shapes.  This
one part is repeated with simple transformations many times.

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").

If I import and render a single object it previews fast and renders fast.

If I import and render multiple parts or I import and render a single part and
and intersecting object (simple cylinder) then it previews fast but will not
render because it throws the following error:

ERROR: CGAL error in CGAL_Nef_polyhedron3(): CGAL ERROR: assertion violation!
Expr: e->incident_sface() != SFace_const_handle() File: /usr/include/CGAL/
Nef_S2/SM_const_decorator.h Line: 321



So...

(1) Can anyone explain what has gone wrong with this approach? openscad
generated the stl without error and I can't see any reason why two (or more
copies) of the same stl file should fail.

(2) Can anyone suggest a sensible alternative?*

* reducing the number of facets or component parts isn't possible - it has to
render smoothly to be functional.

Thanks!


_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Complex model - reducing render time

MichaelAtOz
Administrator
OpenSCAD can export bad STLs.
Importing one and doing CSG operations on it will call CGAL.
CGAL checks internal geometry consistency, and produces such errors when it finds a problem.

Can you share your scad code? And the STLs.

Unfortunately if you hit 32GB, it probably means you have too many triangles.


> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]]
> Sent: Fri, 9 Apr 2021 17:09
> To: [hidden email]
> Subject: [OpenSCAD] Complex model - reducing render time
>
> I've a model that takes ~1s to preview but I cannot render as it requires
> >>32Gb RAM.
>
> It consists of one part which is made of lots of intersecting shapes.  This
> one part is repeated with simple transformations many times.
>
> 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").
>
> If I import and render a single object it previews fast and renders fast.
>
> If I import and render multiple parts or I import and render a single part and
> and intersecting object (simple cylinder) then it previews fast but will not
> render because it throws the following error:
>
> ERROR: CGAL error in CGAL_Nef_polyhedron3(): CGAL ERROR: assertion violation!
> Expr: e->incident_sface() != SFace_const_handle() File: /usr/include/CGAL/
> Nef_S2/SM_const_decorator.h Line: 321
>
>
>
> So...
>
> (1) Can anyone explain what has gone wrong with this approach? openscad
> generated the stl without error and I can't see any reason why two (or more
> copies) of the same stl file should fail.
>
> (2) Can anyone suggest a sensible alternative?*
>
> * reducing the number of facets or component parts isn't possible - it has to
> render smoothly to be functional.
>
> Thanks!
>
>
> _______________________________________________
> OpenSCAD mailing list
> To unsubscribe send an email to [hidden email]


--
This email has been checked for viruses by AVG.
https://www.avg.com
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
OpenSCAD Admin - email* me if you need anything, or if I've done something stupid...
* on the Forum, click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain;
to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.
Reply | Threaded
Open this post in threaded view
|

Re: Complex model - reducing render time

sasa
On Friday, 9 April 2021 08:18:16 BST MichaelAtOz wrote:
> OpenSCAD can export bad STLs.
> Importing one and doing CSG operations on it will call CGAL.
> CGAL checks internal geometry consistency, and produces such errors when it
> finds a problem.
>
> Can you share your scad code? And the STLs.

- I produced the stl using openscad (no errors)
- It renders a single copy (on its own) just fine even transformed
- Multiple copies throws the error
- One copy and another object throws an error

> Unfortunately if you hit 32GB, it probably means you have too many
> triangles.

Sadly I've no way around this the design has to be smooth to be functional...


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!
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]

test.stl (2M) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Complex model - reducing render time

MichaelAtOz
Administrator
That STL is badly broken.


Those white lines are holes, ie gaps in the 3D shell.

> Multiple copies throws the error

Yes you need more than one to cause a union, that calls CGAL, checks the geometry, it's bad, error.

That doesn't look like to many triangles, it is probably that badness causing problems.
OpenSCAD Admin - email* me if you need anything, or if I've done something stupid...
* on the Forum, click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain;
to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.


Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
OpenSCAD Admin - email* me if you need anything, or if I've done something stupid...
* on the Forum, click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain;
to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.
Reply | Threaded
Open this post in threaded view
|

Re: Complex model - reducing render time

sasa
On Friday, 9 April 2021 09:28:52 BST MichaelAtOz wrote:

> That STL is badly broken.
> <http://forum.openscad.org/file/t359/Capture-td32604-bad-stl.jpg>
>
> Those white lines are holes, ie gaps in the 3D shell.
>
> > Multiple copies throws the error
>
> Yes you need more than one to cause a union, that calls CGAL, checks the
> geometry, it's bad, error.
>
> That doesn't look like to many triangles, it is probably that badness
> causing problems.
I don't see any white holes and the stl renders fine in meshlab.


The original object is just an intersection of spheres and cylinders in
openscad, something like


$fn=30;
cylinder(r=1,h=10);
sphere(r=1);
rotate([0,180+15,0])cylinder(r=1,h=10);

but with ~35 segments


The "white" lines don't appear as holes to me - when I zoom in I can see
faces.  I think they are the tops of the cylinders where the spheres are
intersecting them (in the complete smooth limit when $fn->infinity these
wouldn't appear).


so...

If the problem is in the stl that openscad is producing, and there isn't
really a problem with the model how do I fix it?

I'm after a smooth, bendy tube and at the moment I'm using a chain of
cylinders and adding spheres at the corners to heal the fillets. I've tried
several other techniques but they tend to be very cumbersome or slow in
comparison.



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

fillet.png (8K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Complex model - reducing render time

MichaelAtOz
Administrator
That image was from Netfabb, it says it's bad 77 shells (ie discrete separate parts) and 138 holes.

This is meshlab


We can't help if you don't share the complete scad code.
OpenSCAD Admin - email* me if you need anything, or if I've done something stupid...
* on the Forum, click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain;
to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.


Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
OpenSCAD Admin - email* me if you need anything, or if I've done something stupid...
* on the Forum, click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain;
to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.
Reply | Threaded
Open this post in threaded view
|

Re: Complex model - reducing render time

sasa
On Friday, 9 April 2021 10:09:03 BST MichaelAtOz wrote:

> That image was from Netfabb, it says it's bad 77 shells (ie discrete
> separate parts) and 138 holes.
>
> This is meshlab
> <http://forum.openscad.org/file/t359/Capture-td32604-bad-stl-meshlab.jpg>
>
> We can't help if you don't share the complete scad code.
>
>
>
>
> -----
> OpenSCAD Admin - email* me if you need anything,  or if I've done something
> stupid...
>
> * on the Forum, click on my MichaelAtOz label, there is a link to email me.
>
> Unless specifically shown otherwise above, my contribution is in the Public
> Domain; to the extent possible under law, I have waived all copyright and
> related or neighbouring rights to this work. Obviously inclusion of works
> of previous authors is not included in the above.
>
> --
> Sent from: http://forum.openscad.org/

Just hold on a bit - the maths describing the shape is a bit complicated and
half in / half out of the scad file that produces the problem.  I'm just
tidying it up so the scad will just do the rendering and this should be easier
to read.

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Complex model - reducing render time

sasa
In reply to this post by MichaelAtOz
> We can't help if you don't share the complete scad code.


Below: scad to generate the object and a test case that fails:

I can make the problem disappear but at the expense of lumpiness in the final model, this involves extending
the rods by .1 so the significantly overlap. (0.05 doesn't work, the test case warns that result may not be
2-manifold and the real case fails with these errors.


ERROR: CGAL error in CGAL_Nef_polyhedron3(): CGAL ERROR: assertion violation! Expr: e_below != SHalfedge_handle() File: /usr/include/CGAL/Nef_3/SNC_FM_decorator.h Line: 418
ERROR: CGAL error in CGAL_Nef_polyhedron3(): CGAL ERROR: assertion violation! Expr: e->incident_sface() != SFace_const_handle() File: /usr/include/CGAL/Nef_S2/SM_const_decorator.h Line: 321


The construction is =o=o=o=o= where = is a cylinder and o is a sphere used to fill the fillet between the cylinders.

The full model requires hundreds of these objects and I can't render it directly due to memory constraints.

Having a significant overlap might solve the rendering problem but it does not produce an acceptable result because of
the extra features it produces.

It occurs to me this is a rounding problem in openscad and one solution might be to render everything 10x bigger and
then scale the stl it before use





---- test case:


import("test.stl");
translate([0,10,0])import("test.stl");


---- object - save stl to "test.stl"

// sm=0.000000
$fn=30;
// rod sections to make up the main body
translate([0.000000,0,10.593750])rotate([0,180.000000,0])cylinder(r=.2,h=0.187500);
translate([0.000000,0,10.406250])rotate([0,181.080924,0])cylinder(r=.2,h=0.207068);
translate([-0.003906,0,10.199219])rotate([0,181.974934,0])cylinder(r=.2,h=0.226697);
translate([-0.011719,0,9.972656])rotate([0,182.726311,0])cylinder(r=.2,h=0.246373);
translate([-0.023438,0,9.726562])rotate([0,183.366461,0])cylinder(r=.2,h=0.266084);
translate([-0.039062,0,9.460938])rotate([0,183.918249,0])cylinder(r=.2,h=0.285824);
translate([-0.058594,0,9.175781])rotate([0,184.398705,0])cylinder(r=.2,h=0.305588);
translate([-0.082031,0,8.871094])rotate([0,184.820766,0])cylinder(r=.2,h=0.325370);
translate([-0.109375,0,8.546875])rotate([0,185.194429,0])cylinder(r=.2,h=0.345168);
translate([-0.140625,0,8.203125])rotate([0,185.527540,0])cylinder(r=.2,h=0.364978);
translate([-0.175781,0,7.839844])rotate([0,185.826342,0])cylinder(r=.2,h=0.384800);
translate([-0.214844,0,7.457031])rotate([0,186.095862,0])cylinder(r=.2,h=0.404632);
translate([-0.257812,0,7.054688])rotate([0,186.340192,0])cylinder(r=.2,h=0.424471);
translate([-0.304688,0,6.632812])rotate([0,186.562699,0])cylinder(r=.2,h=0.444318);
translate([-0.355469,0,6.191406])rotate([0,186.766175,0])cylinder(r=.2,h=0.464170);
translate([-0.410156,0,5.730469])rotate([0,186.952957,0])cylinder(r=.2,h=0.484028);
translate([-0.468750,0,5.250000])rotate([0,187.125016,0])cylinder(r=.2,h=0.503891);
translate([-0.531250,0,4.750000])rotate([0,186.082337,0])cylinder(r=.2,h=0.479260);
translate([-0.582031,0,4.273438])rotate([0,184.927110,0])cylinder(r=.2,h=0.454806);
translate([-0.621094,0,3.820312])rotate([0,183.641185,0])cylinder(r=.2,h=0.430557);
translate([-0.648438,0,3.390625])rotate([0,182.202598,0])cylinder(r=.2,h=0.406550);
translate([-0.664062,0,2.984375])rotate([0,180.584631,0])cylinder(r=.2,h=0.382832);
translate([-0.667969,0,2.601562])rotate([0,178.754636,0])cylinder(r=.2,h=0.359460);
translate([-0.660156,0,2.242188])rotate([0,176.672596,0])cylinder(r=.2,h=0.336505);
translate([-0.640625,0,1.906250])rotate([0,174.289407,0])cylinder(r=.2,h=0.314059);
translate([-0.609375,0,1.593750])rotate([0,171.544972,0])cylinder(r=.2,h=0.292239);
translate([-0.566406,0,1.304688])rotate([0,168.366366,0])cylinder(r=.2,h=0.271196);
translate([-0.511719,0,1.039062])rotate([0,164.666715,0])cylinder(r=.2,h=0.251127);
translate([-0.445312,0,0.796875])rotate([0,160.346176,0])cylinder(r=.2,h=0.232282);
translate([-0.367188,0,0.578125])rotate([0,155.297570,0])cylinder(r=.2,h=0.214986);
translate([-0.277344,0,0.382812])rotate([0,149.420773,0])cylinder(r=.2,h=0.199640);
translate([-0.175781,0,0.210938])rotate([0,142.650651,0])cylinder(r=.2,h=0.186725);
translate([-0.062500,0,0.062500])rotate([0,135.000000,0])cylinder(r=.2,h=0.176777);
// spheres to fill the fillets
translate([0.000000,0,10.406250])sphere(r=.2);
translate([-0.003906,0,10.199219])sphere(r=.2);
translate([-0.011719,0,9.972656])sphere(r=.2);
translate([-0.023438,0,9.726562])sphere(r=.2);
translate([-0.039062,0,9.460938])sphere(r=.2);
translate([-0.058594,0,9.175781])sphere(r=.2);
translate([-0.082031,0,8.871094])sphere(r=.2);
translate([-0.109375,0,8.546875])sphere(r=.2);
translate([-0.140625,0,8.203125])sphere(r=.2);
translate([-0.175781,0,7.839844])sphere(r=.2);
translate([-0.214844,0,7.457031])sphere(r=.2);
translate([-0.257812,0,7.054688])sphere(r=.2);
translate([-0.304688,0,6.632812])sphere(r=.2);
translate([-0.355469,0,6.191406])sphere(r=.2);
translate([-0.410156,0,5.730469])sphere(r=.2);
translate([-0.468750,0,5.250000])sphere(r=.2);
translate([-0.531250,0,4.750000])sphere(r=.2);
translate([-0.582031,0,4.273438])sphere(r=.2);
translate([-0.621094,0,3.820312])sphere(r=.2);
translate([-0.648438,0,3.390625])sphere(r=.2);
translate([-0.664062,0,2.984375])sphere(r=.2);
translate([-0.667969,0,2.601562])sphere(r=.2);
translate([-0.660156,0,2.242188])sphere(r=.2);
translate([-0.640625,0,1.906250])sphere(r=.2);
translate([-0.609375,0,1.593750])sphere(r=.2);
translate([-0.566406,0,1.304688])sphere(r=.2);
translate([-0.511719,0,1.039062])sphere(r=.2);
translate([-0.445312,0,0.796875])sphere(r=.2);
translate([-0.367188,0,0.578125])sphere(r=.2);
translate([-0.277344,0,0.382812])sphere(r=.2);
translate([-0.175781,0,0.210938])sphere(r=.2);
translate([-0.062500,0,0.062500])sphere(r=.2);


_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Complex model - reducing render time

sasa
In reply to this post by MichaelAtOz
Scaling the model doesn't appear to fix anything



_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Complex model - reducing render time

acwest
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]> wrote:
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]
Reply | Threaded
Open this post in threaded view
|

Re: Complex model - reducing render time

acwest
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]> 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]> wrote:
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]
Reply | Threaded
Open this post in threaded view
|

Re: Complex model - reducing render time

sasa
In reply to this post by acwest

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 <[hidden email]> wrote:
> > 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]
Reply | Threaded
Open this post in threaded view
|

Re: Complex model - reducing render time

acwest
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 , <[hidden email]> 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 <[hidden email]> wrote:
> > 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]

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Complex model - reducing render time

adrianv
In reply to this post by acwest
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]> 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]> wrote:
>
>> 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]


Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Complex model - reducing render time

acwest
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, <[hidden email]> 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]> 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]> wrote:
>
>> 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]


Sent from the OpenSCAD mailing list archive at Nabble.com.
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Complex model - reducing render time

cacb
In reply to this post by sasa
On 09.04.2021 09:46, [hidden email] 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
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Complex model - reducing render time

cacb
In reply to this post by adrianv
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
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Complex model - reducing render time

sasa
In reply to this post by adrianv
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 [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Complex model - reducing render time

nophead
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, <[hidden email]> 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 [hidden email]

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Complex model - reducing render time

JordanBrown
In reply to this post by sasa

On 4/9/2021 12:09 AM, [hidden email] 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.


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