B
brenzo
Mon, Dec 24, 2018 7:17 AM
I have an object I"m creating with patterns on the side.
One thing I'd like to do is to continue the horizontal line around the
curved portion (render code this will be obvious).
I've done this by creating a hollow cylinder, diffing it from some cubes to
retain only a portion of it, then subtracting that form my overall shape.
Somehow, though, I've made this into a computationally intensive operation.
Uncommenting one right will make OpenSCAD noticeably slower. 2 will make it
almost unusable. Uncommenting them all causes it to crash on my machine.
Rendering the rings alone causes no lag so it must be something to do with
using them in the difference() block.
How can I do this differently to avoid this?
//Block base.
module base() {
difference() {
union() {
cube([100, 150, 40]);
translate([50, 150, 0])
cylinder(40, 50, 50);
}
translate([50, 150, 20])
cylinder(60, 40, 40);
translate([50, 50, 25])
cylinder(20, 10.3, 10.7);
}
}
//Make 1/4 of shape, mirror to complete.
module pattern() {
module makepoly() {
polygon([[-1, 10],
[3, 10],
[2, 7],
[6, 7],
[5, 4],
[10, 4],
[6, 0],
[5, 0],
[8, 3],
[4, 3],
[5, 6],
[1, 6],
[2, 9],
[0, 9]]);
}
//Mirrors child but leaves original in place.
module copy_mirror(vec) {
children();
mirror(vec)
children();
}
//Make pattern 3D
linear_extrude(2)
copy_mirror([1, 0, 0])
copy_mirror([0, 1, 0])
makepoly();
linear_extrude(2)
rotate([0, 0, 45])
square(5, center=true);
}
//Pattern on wall.
module wall_pattern(n) {
for (i = [0:n])
translate([18 + i * 32, 1, 0])
scale([1.4, 1.4, 1.4])
translate([0, 0, 14])
rotate([90, 0, 0])
pattern();
}
//Continue ring around curved portion.
module ring(height, a) {
difference() {
//Form a hollow cylinder by diffing 2 clyinders.
translate([0, 0, height])
difference() {
cylinder(2, 51, 51);
translate([0, 0, -1])
cylinder(4, 48, 48);
}
//Rotate cubes about z axis and diff, to create portion of cylinder
union() {
rotate([0, 0, a])
translate([-100, -200, 0])
cube([400, 200, 200]);
rotate([0, 0, -a])
translate([-300, -200, 0])
cube([400, 200, 200]);
}
}
}
//translate([50, 50, 30])
//plant();
difference() {
base();
//Carve out patterns and such
wall_pattern(2);
rotate([0, 0, 90])
wall_pattern(4);
translate([100, 0, 0])
rotate([0, 0, 90])
wall_pattern(4);
translate([-1, -1, 35])
cube([102, 3, 2]);
translate([-1, -1, 2])
cube([102, 3, 2]);
translate([98, 0, 35])
cube([3, 400, 2]);
translate([98, 0, 2])
cube([3, 400, 2]);
translate([-1, 0, 35])
cube([3, 400, 2]);
translate([-1, 0, 2])
cube([3, 400, 2]);
// translate([50, 150, 0])
// ring(35, 0);
//
// translate([50, 150, 0])
// ring(2, 0);
//
// translate([50, 150, 0])
// ring(10, 10);
//
// translate([50, 150, 0])
// ring(18, 20);
//
// translate([50, 150, 0])
// ring(30, 10);
}
--
Sent from: http://forum.openscad.org/
I have an object I"m creating with patterns on the side.
One thing I'd like to do is to continue the horizontal line around the
curved portion (render code this will be obvious).
I've done this by creating a hollow cylinder, diffing it from some cubes to
retain only a portion of it, then subtracting that form my overall shape.
Somehow, though, I've made this into a computationally intensive operation.
Uncommenting one right will make OpenSCAD noticeably slower. 2 will make it
almost unusable. Uncommenting them all causes it to crash on my machine.
Rendering the rings alone causes no lag so it must be something to do with
using them in the difference() block.
How can I do this differently to avoid this?
//Block base.
module base() {
difference() {
union() {
cube([100, 150, 40]);
translate([50, 150, 0])
cylinder(40, 50, 50);
}
translate([50, 150, 20])
cylinder(60, 40, 40);
translate([50, 50, 25])
cylinder(20, 10.3, 10.7);
}
}
//Make 1/4 of shape, mirror to complete.
module pattern() {
module makepoly() {
polygon([[-1, 10],
[3, 10],
[2, 7],
[6, 7],
[5, 4],
[10, 4],
[6, 0],
[5, 0],
[8, 3],
[4, 3],
[5, 6],
[1, 6],
[2, 9],
[0, 9]]);
}
//Mirrors child but leaves original in place.
module copy_mirror(vec) {
children();
mirror(vec)
children();
}
//Make pattern 3D
linear_extrude(2)
copy_mirror([1, 0, 0])
copy_mirror([0, 1, 0])
makepoly();
linear_extrude(2)
rotate([0, 0, 45])
square(5, center=true);
}
//Pattern on wall.
module wall_pattern(n) {
for (i = [0:n])
translate([18 + i * 32, 1, 0])
scale([1.4, 1.4, 1.4])
translate([0, 0, 14])
rotate([90, 0, 0])
pattern();
}
//Continue ring around curved portion.
module ring(height, a) {
difference() {
//Form a hollow cylinder by diffing 2 clyinders.
translate([0, 0, height])
difference() {
cylinder(2, 51, 51);
translate([0, 0, -1])
cylinder(4, 48, 48);
}
//Rotate cubes about z axis and diff, to create portion of cylinder
union() {
rotate([0, 0, a])
translate([-100, -200, 0])
cube([400, 200, 200]);
rotate([0, 0, -a])
translate([-300, -200, 0])
cube([400, 200, 200]);
}
}
}
//translate([50, 50, 30])
//plant();
difference() {
base();
//Carve out patterns and such
wall_pattern(2);
rotate([0, 0, 90])
wall_pattern(4);
translate([100, 0, 0])
rotate([0, 0, 90])
wall_pattern(4);
translate([-1, -1, 35])
cube([102, 3, 2]);
translate([-1, -1, 2])
cube([102, 3, 2]);
translate([98, 0, 35])
cube([3, 400, 2]);
translate([98, 0, 2])
cube([3, 400, 2]);
translate([-1, 0, 35])
cube([3, 400, 2]);
translate([-1, 0, 2])
cube([3, 400, 2]);
// translate([50, 150, 0])
// ring(35, 0);
//
// translate([50, 150, 0])
// ring(2, 0);
//
// translate([50, 150, 0])
// ring(10, 10);
//
// translate([50, 150, 0])
// ring(18, 20);
//
// translate([50, 150, 0])
// ring(30, 10);
}
--
Sent from: http://forum.openscad.org/
KT
Kevin Toppenberg
Tue, Dec 25, 2018 1:56 PM
I just dropped this code into my OpenSCAD on my macMini, and it renders
just fine. There are the cool patterns all around the side. It only takes
a few seconds to get going.
Is there something to do to make it slow?
Kevin
On Mon, Dec 24, 2018 at 2:17 AM brenzo brennanruthardt@gmail.com wrote:
I have an object I"m creating with patterns on the side.
One thing I'd like to do is to continue the horizontal line around the
curved portion (render code this will be obvious).
I've done this by creating a hollow cylinder, diffing it from some cubes to
retain only a portion of it, then subtracting that form my overall shape.
Somehow, though, I've made this into a computationally intensive operation.
Uncommenting one right will make OpenSCAD noticeably slower. 2 will make it
almost unusable. Uncommenting them all causes it to crash on my machine.
Rendering the rings alone causes no lag so it must be something to do with
using them in the difference() block.
How can I do this differently to avoid this?
//Block base.
module base() {
difference() {
union() {
cube([100, 150, 40]);
translate([50, 150, 0])
cylinder(40, 50, 50);
}
translate([50, 150, 20])
cylinder(60, 40, 40);
translate([50, 50, 25])
cylinder(20, 10.3, 10.7);
}
}
//Make 1/4 of shape, mirror to complete.
module pattern() {
module makepoly() {
polygon([[-1, 10],
[3, 10],
[2, 7],
[6, 7],
[5, 4],
[10, 4],
[6, 0],
[5, 0],
[8, 3],
[4, 3],
[5, 6],
[1, 6],
[2, 9],
[0, 9]]);
}
//Mirrors child but leaves original in place.
module copy_mirror(vec) {
children();
mirror(vec)
children();
}
//Make pattern 3D
linear_extrude(2)
copy_mirror([1, 0, 0])
copy_mirror([0, 1, 0])
makepoly();
linear_extrude(2)
rotate([0, 0, 45])
square(5, center=true);
}
//Pattern on wall.
module wall_pattern(n) {
for (i = [0:n])
translate([18 + i * 32, 1, 0])
scale([1.4, 1.4, 1.4])
translate([0, 0, 14])
rotate([90, 0, 0])
pattern();
}
//Continue ring around curved portion.
module ring(height, a) {
difference() {
//Form a hollow cylinder by diffing 2 clyinders.
translate([0, 0, height])
difference() {
cylinder(2, 51, 51);
translate([0, 0, -1])
cylinder(4, 48, 48);
}
//Rotate cubes about z axis and diff, to create portion of cylinder
union() {
rotate([0, 0, a])
translate([-100, -200, 0])
cube([400, 200, 200]);
rotate([0, 0, -a])
translate([-300, -200, 0])
cube([400, 200, 200]);
}
}
}
//translate([50, 50, 30])
//plant();
difference() {
base();
//Carve out patterns and such
wall_pattern(2);
rotate([0, 0, 90])
wall_pattern(4);
translate([100, 0, 0])
rotate([0, 0, 90])
wall_pattern(4);
translate([-1, -1, 35])
cube([102, 3, 2]);
translate([-1, -1, 2])
cube([102, 3, 2]);
translate([98, 0, 35])
cube([3, 400, 2]);
translate([98, 0, 2])
cube([3, 400, 2]);
translate([-1, 0, 35])
cube([3, 400, 2]);
translate([-1, 0, 2])
cube([3, 400, 2]);
// translate([50, 150, 0])
// ring(35, 0);
//
// translate([50, 150, 0])
// ring(2, 0);
//
// translate([50, 150, 0])
// ring(10, 10);
//
// translate([50, 150, 0])
// ring(18, 20);
//
// translate([50, 150, 0])
// ring(30, 10);
}
--
Sent from: http://forum.openscad.org/
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
I just dropped this code into my OpenSCAD on my macMini, and it renders
just fine. There are the cool patterns all around the side. It only takes
a few seconds to get going.
Is there something to do to make it slow?
Kevin
On Mon, Dec 24, 2018 at 2:17 AM brenzo <brennanruthardt@gmail.com> wrote:
> I have an object I"m creating with patterns on the side.
>
> One thing I'd like to do is to continue the horizontal line around the
> curved portion (render code this will be obvious).
>
> I've done this by creating a hollow cylinder, diffing it from some cubes to
> retain only a portion of it, then subtracting that form my overall shape.
>
> Somehow, though, I've made this into a computationally intensive operation.
> Uncommenting one right will make OpenSCAD noticeably slower. 2 will make it
> almost unusable. Uncommenting them all causes it to crash on my machine.
>
> Rendering the rings alone causes no lag so it must be something to do with
> using them in the difference() block.
>
> How can I do this differently to avoid this?
>
> //Block base.
> module base() {
> difference() {
> union() {
> cube([100, 150, 40]);
> translate([50, 150, 0])
> cylinder(40, 50, 50);
> }
> translate([50, 150, 20])
> cylinder(60, 40, 40);
> translate([50, 50, 25])
> cylinder(20, 10.3, 10.7);
> }
>
> }
>
> //Make 1/4 of shape, mirror to complete.
> module pattern() {
> module makepoly() {
> polygon([[-1, 10],
> [3, 10],
> [2, 7],
> [6, 7],
> [5, 4],
> [10, 4],
> [6, 0],
> [5, 0],
> [8, 3],
> [4, 3],
> [5, 6],
> [1, 6],
> [2, 9],
> [0, 9]]);
> }
>
> //Mirrors child but leaves original in place.
> module copy_mirror(vec) {
> children();
> mirror(vec)
> children();
> }
>
> //Make pattern 3D
> linear_extrude(2)
> copy_mirror([1, 0, 0])
> copy_mirror([0, 1, 0])
> makepoly();
>
> linear_extrude(2)
> rotate([0, 0, 45])
> square(5, center=true);
> }
>
> //Pattern on wall.
> module wall_pattern(n) {
> for (i = [0:n])
> translate([18 + i * 32, 1, 0])
> scale([1.4, 1.4, 1.4])
> translate([0, 0, 14])
> rotate([90, 0, 0])
> pattern();
> }
>
> //Continue ring around curved portion.
> module ring(height, a) {
> difference() {
> //Form a hollow cylinder by diffing 2 clyinders.
> translate([0, 0, height])
> difference() {
> cylinder(2, 51, 51);
>
> translate([0, 0, -1])
> cylinder(4, 48, 48);
> }
>
> //Rotate cubes about z axis and diff, to create portion of cylinder
> union() {
> rotate([0, 0, a])
> translate([-100, -200, 0])
> cube([400, 200, 200]);
>
> rotate([0, 0, -a])
> translate([-300, -200, 0])
> cube([400, 200, 200]);
> }
> }
> }
>
> //translate([50, 50, 30])
> //plant();
> difference() {
> base();
>
> //Carve out patterns and such
> wall_pattern(2);
>
> rotate([0, 0, 90])
> wall_pattern(4);
>
> translate([100, 0, 0])
> rotate([0, 0, 90])
> wall_pattern(4);
>
> translate([-1, -1, 35])
> cube([102, 3, 2]);
>
> translate([-1, -1, 2])
> cube([102, 3, 2]);
>
> translate([98, 0, 35])
> cube([3, 400, 2]);
>
> translate([98, 0, 2])
> cube([3, 400, 2]);
>
> translate([-1, 0, 35])
> cube([3, 400, 2]);
>
> translate([-1, 0, 2])
> cube([3, 400, 2]);
>
> // translate([50, 150, 0])
> // ring(35, 0);
> //
> // translate([50, 150, 0])
> // ring(2, 0);
> //
> // translate([50, 150, 0])
> // ring(10, 10);
> //
> // translate([50, 150, 0])
> // ring(18, 20);
> //
> // translate([50, 150, 0])
> // ring(30, 10);
> }
>
>
>
> --
> Sent from: http://forum.openscad.org/
>
> _______________________________________________
> OpenSCAD mailing list
> Discuss@lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
PR
Peter Ragosch
Tue, Dec 25, 2018 5:28 PM
I just dropped this code into my OpenSCAD on my macMini, and it
renders just fine. There are the cool patterns all around the side.
It only takes a few seconds to get going.
Is there something to do to make it slow?
Kevin
On Mon, Dec 24, 2018 at 2:17 AM brenzo brennanruthardt@gmail.com
wrote:
I have an object I"m creating with patterns on the side.
One thing I'd like to do is to continue the horizontal line around
the curved portion (render code this will be obvious).
I've done this by creating a hollow cylinder, diffing it from some
cubes to retain only a portion of it, then subtracting that form my
overall shape.
Somehow, though, I've made this into a computationally intensive
operation. Uncommenting one right will make OpenSCAD noticeably
slower. 2 will make it almost unusable. Uncommenting them all
causes it to crash on my machine.
Rendering the rings alone causes no lag so it must be something to
do with using them in the difference() block.
How can I do this differently to avoid this?
//Block base.
module base() {
difference() {
union() {
cube([100, 150, 40]);
translate([50, 150, 0])
cylinder(40, 50, 50);
}
translate([50, 150, 20])
cylinder(60, 40, 40);
translate([50, 50, 25])
cylinder(20, 10.3, 10.7);
}
}
//Make 1/4 of shape, mirror to complete.
module pattern() {
module makepoly() {
polygon([[-1, 10],
[3, 10],
[2, 7],
[6, 7],
[5, 4],
[10, 4],
[6, 0],
[5, 0],
[8, 3],
[4, 3],
[5, 6],
[1, 6],
[2, 9],
[0, 9]]);
}
//Mirrors child but leaves original in place.
module copy_mirror(vec) {
children();
mirror(vec)
children();
}
//Make pattern 3D
linear_extrude(2)
copy_mirror([1, 0, 0])
copy_mirror([0, 1, 0])
makepoly();
linear_extrude(2)
rotate([0, 0, 45])
square(5, center=true);
}
//Pattern on wall.
module wall_pattern(n) {
for (i = [0:n])
translate([18 + i * 32, 1, 0])
scale([1.4, 1.4, 1.4])
translate([0, 0, 14])
rotate([90, 0, 0])
pattern();
}
//Continue ring around curved portion.
module ring(height, a) {
difference() {
//Form a hollow cylinder by diffing 2 clyinders.
translate([0, 0, height])
difference() {
cylinder(2, 51, 51);
translate([0, 0, -1])
cylinder(4, 48, 48);
}
//Rotate cubes about z axis and diff, to create portion of
cylinder union() {
rotate([0, 0, a])
translate([-100, -200, 0])
cube([400, 200, 200]);
rotate([0, 0, -a])
translate([-300, -200, 0])
cube([400, 200, 200]);
}
}
}
//translate([50, 50, 30])
//plant();
difference() {
base();
//Carve out patterns and such
wall_pattern(2);
rotate([0, 0, 90])
wall_pattern(4);
translate([100, 0, 0])
rotate([0, 0, 90])
wall_pattern(4);
translate([-1, -1, 35])
cube([102, 3, 2]);
translate([-1, -1, 2])
cube([102, 3, 2]);
translate([98, 0, 35])
cube([3, 400, 2]);
translate([98, 0, 2])
cube([3, 400, 2]);
translate([-1, 0, 35])
cube([3, 400, 2]);
translate([-1, 0, 2])
cube([3, 400, 2]);
// translate([50, 150, 0])
// ring(35, 0);
//
// translate([50, 150, 0])
// ring(2, 0);
//
// translate([50, 150, 0])
// ring(10, 10);
//
// translate([50, 150, 0])
// ring(18, 20);
//
// translate([50, 150, 0])
// ring(30, 10);
}
--
Sent from: http://forum.openscad.org/
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Only a hint:
If the last four rings are not commented out, F5 and F6 will be
slowed down. May be the reason is based on the difference of base() and
the Carve out patterns. There, the rings should not only cut the
base(), which is build up using difference(), but also its child
cylinders. For doing that, the children() method seems to be needed
here.
I'm sorry, I can't give you an code example, because I'm very unfamiliar
with this method. But have a look at the documentation.
--
Mit freundlichen Grüßen
Best Regards
Peter Ragosch
Am Tue, 25 Dec 2018 08:56:53 -0500
schrieb Kevin Toppenberg <kdtop3@gmail.com>:
> I just dropped this code into my OpenSCAD on my macMini, and it
> renders just fine. There are the cool patterns all around the side.
> It only takes a few seconds to get going.
>
> Is there something to do to make it slow?
>
> Kevin
>
> On Mon, Dec 24, 2018 at 2:17 AM brenzo <brennanruthardt@gmail.com>
> wrote:
>
> > I have an object I"m creating with patterns on the side.
> >
> > One thing I'd like to do is to continue the horizontal line around
> > the curved portion (render code this will be obvious).
> >
> > I've done this by creating a hollow cylinder, diffing it from some
> > cubes to retain only a portion of it, then subtracting that form my
> > overall shape.
> >
> > Somehow, though, I've made this into a computationally intensive
> > operation. Uncommenting one right will make OpenSCAD noticeably
> > slower. 2 will make it almost unusable. Uncommenting them all
> > causes it to crash on my machine.
> >
> > Rendering the rings alone causes no lag so it must be something to
> > do with using them in the difference() block.
> >
> > How can I do this differently to avoid this?
> >
> > //Block base.
> > module base() {
> > difference() {
> > union() {
> > cube([100, 150, 40]);
> > translate([50, 150, 0])
> > cylinder(40, 50, 50);
> > }
> > translate([50, 150, 20])
> > cylinder(60, 40, 40);
> > translate([50, 50, 25])
> > cylinder(20, 10.3, 10.7);
> > }
> >
> > }
> >
> > //Make 1/4 of shape, mirror to complete.
> > module pattern() {
> > module makepoly() {
> > polygon([[-1, 10],
> > [3, 10],
> > [2, 7],
> > [6, 7],
> > [5, 4],
> > [10, 4],
> > [6, 0],
> > [5, 0],
> > [8, 3],
> > [4, 3],
> > [5, 6],
> > [1, 6],
> > [2, 9],
> > [0, 9]]);
> > }
> >
> > //Mirrors child but leaves original in place.
> > module copy_mirror(vec) {
> > children();
> > mirror(vec)
> > children();
> > }
> >
> > //Make pattern 3D
> > linear_extrude(2)
> > copy_mirror([1, 0, 0])
> > copy_mirror([0, 1, 0])
> > makepoly();
> >
> > linear_extrude(2)
> > rotate([0, 0, 45])
> > square(5, center=true);
> > }
> >
> > //Pattern on wall.
> > module wall_pattern(n) {
> > for (i = [0:n])
> > translate([18 + i * 32, 1, 0])
> > scale([1.4, 1.4, 1.4])
> > translate([0, 0, 14])
> > rotate([90, 0, 0])
> > pattern();
> > }
> >
> > //Continue ring around curved portion.
> > module ring(height, a) {
> > difference() {
> > //Form a hollow cylinder by diffing 2 clyinders.
> > translate([0, 0, height])
> > difference() {
> > cylinder(2, 51, 51);
> >
> > translate([0, 0, -1])
> > cylinder(4, 48, 48);
> > }
> >
> > //Rotate cubes about z axis and diff, to create portion of
> > cylinder union() {
> > rotate([0, 0, a])
> > translate([-100, -200, 0])
> > cube([400, 200, 200]);
> >
> > rotate([0, 0, -a])
> > translate([-300, -200, 0])
> > cube([400, 200, 200]);
> > }
> > }
> > }
> >
> > //translate([50, 50, 30])
> > //plant();
> > difference() {
> > base();
> >
> > //Carve out patterns and such
> > wall_pattern(2);
> >
> > rotate([0, 0, 90])
> > wall_pattern(4);
> >
> > translate([100, 0, 0])
> > rotate([0, 0, 90])
> > wall_pattern(4);
> >
> > translate([-1, -1, 35])
> > cube([102, 3, 2]);
> >
> > translate([-1, -1, 2])
> > cube([102, 3, 2]);
> >
> > translate([98, 0, 35])
> > cube([3, 400, 2]);
> >
> > translate([98, 0, 2])
> > cube([3, 400, 2]);
> >
> > translate([-1, 0, 35])
> > cube([3, 400, 2]);
> >
> > translate([-1, 0, 2])
> > cube([3, 400, 2]);
> >
> > // translate([50, 150, 0])
> > // ring(35, 0);
> > //
> > // translate([50, 150, 0])
> > // ring(2, 0);
> > //
> > // translate([50, 150, 0])
> > // ring(10, 10);
> > //
> > // translate([50, 150, 0])
> > // ring(18, 20);
> > //
> > // translate([50, 150, 0])
> > // ring(30, 10);
> > }
> >
> >
> >
> > --
> > Sent from: http://forum.openscad.org/
> >
> > _______________________________________________
> > OpenSCAD mailing list
> > Discuss@lists.openscad.org
> > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
> >
Only a hint:
If the last four rings are not commented out, F5 and F6 will be
slowed down. May be the reason is based on the difference of base() and
the Carve out patterns. There, the rings should not only cut the
base(), which is build up using difference(), but also its child
cylinders. For doing that, the children() method seems to be needed
here.
I'm sorry, I can't give you an code example, because I'm very unfamiliar
with this method. But have a look at the documentation.
--
Mit freundlichen Grüßen
Best Regards
Peter Ragosch