

I am just learning OpenSCAD, i want to make a sierpinski with spheres in the void spaces, so i tried to run a sierpinki script and it crashed due to error on the first line...
from openscad import * from math import sqrt, pow, sin, cos
# numbers of iterations to recurse, you don't need many iterations = 5 [....]
it doesnt seem backwards compatible? what programs can run .scad files?
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


On 06/27/2015 01:00 PM, Anto wrote:
> I am just learning OpenSCAD, i want to make a sierpinski with
> spheres in the void spaces, so i tried to run a sierpinki script
> and it crashed due to error on the first line...
>
> from openscad import *
> from math import sqrt, pow, sin, cos
>
> # numbers of iterations to recurse, you don't need many
> iterations = 5
> [....]
>
> it doesnt seem backwards compatible? what programs can run .scad files?
>
This is no OpenSCAD script. From the syntax it looks like some
python wrapper (maybe https://github.com/kevinmehall/pyscad ?).
But there are lots of python related project, so it's hard to tell
which one it actually is.
Maybe have a look at http://www.thingiverse.com/thing:187131which has the scad script attached.
ciao,
Torsten.
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
 Torsten


Thanks Torsten, there are quite alot of error codes on Thingiverse.
I have managed the sierpinski with spheres, some of the sizes are wrong, here it is:
TETRA_POINTS = [ [1/sqrt(3), 0, sqrt(2/3)*.33], [1/(2*sqrt(3)), 1/2, sqrt(2/3)*.33], [1/(2*sqrt(3)), 1/2, sqrt(2/3)*.33], [0, 0, sqrt(2/3)*.66] ];
TETRA_POINTS2 = [ [1/sqrt(3), 0, 0], [1/(2*sqrt(3)), 1/2, 0], [1/(2*sqrt(3)), 1/2, 0], [0, 0, sqrt(2/3)], [0, 0, sqrt(2/3)*.5] ];
module tetra() { polyhedron( points=TETRA_POINTS, triangles=[ [0, 1, 2], [2, 1, 3], [0, 2, 3], [0, 3, 1] ]); }
module siervoids(n, overscale=0.2) { if (n == 0) { //scale(.3) //cube(); } else { for (pt = TETRA_POINTS) { scale(n*n*.041) sphere(r=5); translate(pow(2, n  1) * pt) siervoids(n  1); } } }
module sier(n, overscale=0.2) { if (n == 0) { scale(1 + overscale) tetra(); } else { for (pt = TETRA_POINTS) { translate(pow(2, n  1) * pt) sier(n  1); } } } siervoids(6); sier(6); From: Torsten Paul <[hidden email]> To: [hidden email] Sent: Saturday, June 27, 2015 1:46 PM Subject: Re: [OpenSCAD] making a sierpinski with OpenSCAD On 06/27/2015 01:00 PM, Anto wrote:
> I am just learning OpenSCAD, i want to make a sierpinski with > spheres in the void spaces, so i tried to run a sierpinki script > and it crashed due to error on the first line... > > from openscad import * > from math import sqrt, pow, sin, cos > > # numbers of iterations to recurse, you don't need many > iterations = 5 > [....] > > it doesnt seem backwards compatible? what programs can run .scad files?
> This is no OpenSCAD script. From the syntax it looks like some python wrapper (maybe https://github.com/kevinmehall/pyscad ?). But there are lots of python related project, so it's hard to tell which one it actually is. Maybe have a look at http://www.thingiverse.com/thing:187131which has the scad script attached. ciao, Torsten. _______________________________________________ OpenSCAD mailing list [hidden email]http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


Working pretty well but its adhoc nature is starting to defeat you.
There are many alg for creating these and you have chosen one where the triangles grow from the center out. You have oversized the geo so there is overlap for your physical model.
 Note that the oversized factor in sier never works unless you make only a single triangle.
Actually it looks like it was from thingiverse...
Another approach would be to use a non recursive routine. This will be easier to control the oversize for overlaps.
Another approach would be to have the first triangle become the largest encompassing triangle then every level beings to subtract the geo from the prior models. OpenSCAD is good at this.
Check out some online algorithms for creation. Your initial foray was finding a python program. These can be easy to read and a good source of info. There are many pages on Sierpinski algorithms online.
Remember the volume of a triangle and volume of a sphere are calculated differently and this factor difference is what you need to get the right size for spheres.
Try starting with a more normalised pyramid. The math might be easier.

