After solving the roundedBox() slow performance problem with the
roundedCube() module, I'd tried to go one step further, making a
roundedCube with 2 radii (and it's more general than the one radius
version).
The problem here is that the hull in roundedCylinder() is also very slow,
making roundedCube2R() taking almost 9 seconds to preview.
Does anybody can suggest a faster approach?
//roundedCylinder(r=20, ra=4, h=50);
roundedCube2R([50,50,50], r1=10, r2=8, center=true);
module roundedCube2R(size, r1, r2, center=true) {
s = is_list(size) ? size : [size,size,size];
translate(center ? -s/2 : [0,0,0]) {
hull() {
translate([ r1, r1]) roundedCylinder(r=r1, ra=r2, h=s[2]);
translate([ r1,s[1]-r1]) roundedCylinder(r=r1, ra=r2, h=s[2]);
translate([s[0]-r1, r1]) roundedCylinder(r=r1, ra=r2, h=s[2]);
translate([s[0]-r1,s[1]-r1]) roundedCylinder(r=r1, ra=r2, h=s[2]);
}
}
}
//--------------------------------------------------------------------------
module roundedCylinder(r, ra, h) {
hull() {
translate([0,0,ra]) rotate_extrude(convexity = 10) translate([r, 0, 0])
circle(r = ra);
translate([0,0,h-ra]) rotate_extrude(convexity = 10) translate([r, 0, 0])
circle(r = ra);
}
}
//--------------------------------------------------------------------------
--
Sent from: http://forum.openscad.org/
It doesn't take any time on my laptop.
Parsing design (AST generation)...
Saved backup file:
C:/Users/ChrisP/Documents/OpenSCAD/backups/unsaved-backup-qvcmuRXl.scad
Compiling design (CSG Tree generation)...
Compiling design (CSG Products generation)...
Geometries in cache: 11
Geometry cache size in bytes: 707384
CGAL Polyhedrons in cache: 0
CGAL cache size in bytes: 0
Compiling design (CSG Products normalization)...
Normalized CSG tree has 1 elements
Compile and preview finished.
Total rendering time: 0 hours, 0 minutes, 0 seconds
Parsing design (AST generation)...
Saved backup file:
C:/Users/ChrisP/Documents/OpenSCAD/backups/unsaved-backup-qvcmuRXl.scad
Compiling design (CSG Tree generation)...
Rendering Polygon Mesh using CGAL...
Geometries in cache: 12
Geometry cache size in bytes: 774640
CGAL Polyhedrons in cache: 0
CGAL cache size in bytes: 0
Total rendering time: 0 hours, 0 minutes, 0 seconds
Top level object is a 3D object:
Facets: 932
Rendering finished.
On Sat, 16 Nov 2019 at 13:25, MVAckel via Discuss <
discuss@lists.openscad.org> wrote:
After solving the roundedBox() slow performance problem with the
roundedCube() module, I'd tried to go one step further, making a
roundedCube with 2 radii (and it's more general than the one radius
version).
The problem here is that the hull in roundedCylinder() is also very slow,
making roundedCube2R() taking almost 9 seconds to preview.
Does anybody can suggest a faster approach?
//roundedCylinder(r=20, ra=4, h=50);
roundedCube2R([50,50,50], r1=10, r2=8, center=true);
module roundedCube2R(size, r1, r2, center=true) {
s = is_list(size) ? size : [size,size,size];
translate(center ? -s/2 : [0,0,0]) {
hull() {
translate([ r1, r1])
roundedCylinder(r=r1, ra=r2, h=s[2]);
translate([ r1,s[1]-r1])
roundedCylinder(r=r1, ra=r2, h=s[2]);
translate([s[0]-r1, r1])
roundedCylinder(r=r1, ra=r2, h=s[2]);
translate([s[0]-r1,s[1]-r1])
roundedCylinder(r=r1, ra=r2, h=s[2]);
}
}
}
//--------------------------------------------------------------------------
module roundedCylinder(r, ra, h) {
hull() {
translate([0,0,ra]) rotate_extrude(convexity = 10)
translate([r, 0, 0])
circle(r = ra);
translate([0,0,h-ra]) rotate_extrude(convexity = 10)
translate([r, 0, 0])
circle(r = ra);
}
}
//--------------------------------------------------------------------------
--
Sent from: http://forum.openscad.org/
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
After playing around with two different computers it seems that the problem
is with my graphic card driver.
One computer is always fast. The other computer is an i7 with Geforce GTX850
Ti. The slow preview happens when "Enable for OpenGL 1.x" and "Force
Goldfeather" are both enabled and it's not very consistent - if you keep the
parameters unaltered the preview is fast, but changing the parameters for
each preview, about 1 in 3 times the preview is slow again.
Anyway, I turned off both options in preferences and will try to update the
graphic card driver.
Thank you for the fast answer!
--
Sent from: http://forum.openscad.org/