$fn=100 is a large round number, so it sounds like Jon may have done what a
lot of us do, which is just pick a random number that is obviously big
enough.
The advantage of Trygon's $fe technique is that it's easy to be more
precise than "pick a large random number". $fe=0.1 means render to a
precision of 100 microns, which is good enough for most 3D printing jobs. A
lot of consumer grade 3D printers don't support layer heights less than 100
microns. Since you know how precise you want your 3D print job to be, it's
not hard to pick a value for $fe that is small enough, without being
excessively small. Too much precision slows rendering down too much.
On 6 December 2015 at 15:57, Peter Falke <
stempeldergeschichte@googlemail.com> wrote:
I asumed jon had a reason for choosing fn=100.
2015-12-06 21:49 GMT+01:00 Trygon db5765@outlook.com:
Peter,
I assume that your comment, "Your code renders in 2 hours, 4 minutes, 48
seconds on my machine.", was not with regard to the modified code I
provided? The modified code with $fe=0.1 renders in 6 minutes, 21 seconds
on my PC.
Trygon
--
View this message in context:
http://forum.openscad.org/here-s-an-interesting-one-to-speed-optimize-tp14966p14985.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Hi,
What if something like this:
Sides = 100;
DefaultSides=24;
Height = 200; // 30;
Diam = 35;
Thick=6;
module Tube(Length,Dout,Din,Sides) //render(convexity=2)
{
NSides= (Sides < 3 || Sides==undef) ? DefaultSides : Sides;
rotate_extrude(convexity=2, $fn=NSides) translate([Din/2,0,0])
square([(Dout-Din)/2,Length]);
}
//Tube();
module HoleCylinder() render(convexity=2)
{
Din=Diam;
Dout=Diam+Thick;
difference() {
Tube(Height,Dout,Din,Sides);
for (i = [15:6:Height-15]) {
for (j=[0:360/20]) {
rotate([j*20, 90, 0]) translate([-i,0, 10]) cylinder(r=2,h=16);
}
}
}
}
HoleCylinder();
In my dual core running Windows7 32bit it renders in less than 2 minutes.
The part of the module missing is not significant in terms of speed.
Regards
jpmendes
--
View this message in context: http://forum.openscad.org/here-s-an-interesting-one-to-speed-optimize-tp14966p14999.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Actually, no. I just grabbed the number out of the air. Everyone else
is right: I could have used $fn=5 easily enough. I just wanted it to be
pretty!
Jon
On 12/6/2015 3:57 PM, Peter Falke wrote:
I asumed jon had a reason for choosing fn=100.
2015-12-06 21:49 GMT+01:00 Trygon <db5765@outlook.com
mailto:db5765@outlook.com>:
Peter,
I assume that your comment, "Your code renders in 2 hours, 4
minutes, 48
seconds on my machine.", was not with regard to the modified code I
provided? The modified code with $fe=0.1 renders in 6 minutes, 21
seconds
on my PC.
Trygon
I usually start at $fn=8 for octagonal coverage and work up from there as needed.
Andrew.
Sent from myBrain
On Dec 6, 2015, at 18:28, jon jon@jonbondy.com wrote:
Actually, no. I just grabbed the number out of the air. Everyone else is right: I could have used $fn=5 easily enough. I just wanted it to be pretty!
Jon
On 12/6/2015 3:57 PM, Peter Falke wrote:
I asumed jon had a reason for choosing fn=100.
2015-12-06 21:49 GMT+01:00 Trygon db5765@outlook.com:
Peter,
I assume that your comment, "Your code renders in 2 hours, 4 minutes, 48
seconds on my machine.", was not with regard to the modified code I
provided? The modified code with $fe=0.1 renders in 6 minutes, 21 seconds
on my PC.
Trygon
For the forum. looks like this:
http://forum.openscad.org/file/n15005/bondy-OpenSCAD.png
The difference between the two left most ones is in the module
HoleCylinder()
$fn = undef;
$fs=0.01; // very small => $fa used
$fe=0.1; // 0.1/4 for final output?
rch = 0.1;
height = 200; // 30;
diam = 35;
function fa(r)=$fn>0?360/($fn>3?$fn:3):
$fe>0?$fe<r?min(45,2*acos(1-$fe/r)):45:
360/max(min(360/($fa>0.01?$fa:0.01),
2*PI*r/($fs>0.01?$fs:0.01)),5);
module HoleCylinder()
cylinder(h = 100, d = diam/10, $fa=fa(diam/20)); // intersecting
// translate([0,0,diam/2-4]) // non-intersecting
// cylinder(h = 8, d = diam/10);
difference() {
// outer
cylinder(h = height, d = diam, $fa=fa(diam/2));
// inner
translate([0, 0, -1])
cylinder(h = height + 2, d = diam - 4, $fa=fa((diam-4)/2));
// reduce the bottom end
translate([0, 0, -1])
cylinder(h = 10 + 1, d = diam - 2 + rch, $fa=fa((diam-2+rch)/2));
// reduce the top end
translate([0, 0, height - 10])
difference() {
cylinder(h = 10 + 1, d = diam + 1, $fa=fa((diam+1)/2));
cylinder(h = 10 + 1, d = diam - 2 - rch, $fa=fa((diam-2-rch)/2));
}
// holes
for (i = [15:5:height-15])
for (a = [0:15:359])
translate([0, 0, i])
rotate([0, 90, a])
HoleCylinder();
}
--
View this message in context: http://forum.openscad.org/here-s-an-interesting-one-to-speed-optimize-tp14966p15005.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Dear jpmendes,
I had a look at your code: The cylinders that you subtract are overlapping
by a little bit.
Now I realise this is not so importend in this case, decreasing fn makes it
run fast enough.
This line
rotate([j*20, 90, 0]) translate([-i,0, 10])
cylinder(r=2,h=16);
I changed to
rotate([j*20, 90, 0]) translate([-i,0, 15])
cylinder(r=2,h=16);
to remove the overlap.
This makes it 20 % faster in F5, preview and F6, render.
Here are the numbers:
F5, with overlap of the subtracted cylinders: 1 minutes 38 seconds
F5, no overlap: 1 minutes, 23 seconds, gain in speed 20%
F6, no overlap: 1 minutes, 23 seconds, gain in speed 20%
F6, with overlap: 1 minutes, 36 seconds
2015-12-07 4:04 GMT+01:00 Neon22 mschafer@wireframe.biz:
For the forum. looks like this:
http://forum.openscad.org/file/n15005/bondy-OpenSCAD.png
The difference between the two left most ones is in the module
HoleCylinder()
$fn = undef;
$fs=0.01; // very small => $fa used
$fe=0.1; // 0.1/4 for final output?
rch = 0.1;
height = 200; // 30;
diam = 35;
function fa(r)=$fn>0?360/($fn>3?$fn:3):
$fe>0?$fe<r?min(45,2*acos(1-$fe/r)):45:
360/max(min(360/($fa>0.01?$fa:0.01),
2*PI*r/($fs>0.01?$fs:0.01)),5);
module HoleCylinder()
cylinder(h = 100, d = diam/10, $fa=fa(diam/20)); // intersecting
// translate([0,0,diam/2-4]) // non-intersecting
// cylinder(h = 8, d = diam/10);
difference() {
// outer
cylinder(h = height, d = diam, $fa=fa(diam/2));
// inner
translate([0, 0, -1])
cylinder(h = height + 2, d = diam - 4, $fa=fa((diam-4)/2));
// reduce the bottom end
translate([0, 0, -1])
cylinder(h = 10 + 1, d = diam - 2 + rch,
$fa=fa((diam-2+rch)/2));
// reduce the top end
translate([0, 0, height - 10])
difference() {
cylinder(h = 10 + 1, d = diam + 1,
$fa=fa((diam+1)/2));
cylinder(h = 10 + 1, d = diam - 2 - rch,
$fa=fa((diam-2-rch)/2));
}
// holes
for (i = [15:5:height-15])
for (a = [0:15:359])
translate([0, 0, i])
rotate([0, 90, a])
HoleCylinder();
}
--
View this message in context:
http://forum.openscad.org/here-s-an-interesting-one-to-speed-optimize-tp14966p15005.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org