discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

little question

KE
Karl Exler
Tue, Jul 16, 2024 8:18 AM

Dear all

...... this is the way a non programmer works.. but it is painful. :-(


include <bosl2/std.scad>

$fn=100;
id=55; //Innendurchmesser
od=64; //Außendurchmesser
h=10;  //Höhe über Alles
s=2;   //Stärke

translate([0,0,h/2+s/2])
tube(h=h-s, or=id/2, wall=s);
difference()

{
cylinder(s,d=od);
    translate([-id/20.7,id/20.4,s0.5]) sphere(r=2);
    translate([-id/2
0.3,id/20.6,s0.5]) sphere(r=2);
    translate([id/20.4,id/20.5,s0.5]) sphere(r=2);
    translate([id/2
0.5,id/20.2,s0.5]) sphere(r=2);
    translate([id/20.2,-id/20.3,s0.5]) sphere(r=2);
    translate([-id/2
0.6,id/2*-0.3,s*0.5]) sphere(r=2);
}


How can I manage to get a valid array of coordinates which are all
within a defined circle with a diameter of n?

Many thanks in advance
Karl

P.S.
the goal is to print a kind of lid for different sizes of glasses... to
use them as vase for small flowers.

Dear all ...... this is the way a non programmer works.. but it is painful. :-( ---------------------------------------------------------------------------- include <bosl2/std.scad> $fn=100; id=55; //Innendurchmesser od=64; //Außendurchmesser h=10;  //Höhe über Alles s=2;   //Stärke translate([0,0,h/2+s/2]) tube(h=h-s, or=id/2, wall=s); difference() { cylinder(s,d=od);     translate([-id/2*0.7,id/2*0.4,s*0.5]) sphere(r=2);     translate([-id/2*0.3,id/2*0.6,s*0.5]) sphere(r=2);     translate([id/2*0.4,id/2*0.5,s*0.5]) sphere(r=2);     translate([id/2*0.5,id/2*0.2,s*0.5]) sphere(r=2);     translate([id/2*0.2,-id/2*0.3,s*0.5]) sphere(r=2);     translate([-id/2*0.6,id/2*-0.3,s*0.5]) sphere(r=2); } ------------------------------------------- How can I manage to get a valid array of coordinates which are all within a defined circle with a diameter of n? Many thanks in advance Karl P.S. the goal is to print a kind of lid for different sizes of glasses... to use them as vase for small flowers.
DP
Dan Perry
Tue, Jul 16, 2024 8:42 AM

This line of code replaces your six lines to make the spheres:

for (angle = [0:60:300]) { rotate([0, 0, angle]) translate([-id/20.7,0,
0.5
s]) sphere(2);}

[image: image.png]

On Tue, Jul 16, 2024 at 9:18 AM Karl Exler via Discuss <
discuss@lists.openscad.org> wrote:

Dear all

...... this is the way a non programmer works.. but it is painful. :-(


include <bosl2/std.scad>

$fn=100;
id=55; //Innendurchmesser
od=64; //Außendurchmesser
h=10;  //Höhe über Alles
s=2;  //Stärke

translate([0,0,h/2+s/2])
tube(h=h-s, or=id/2, wall=s);
difference()

{
cylinder(s,d=od);
translate([-id/20.7,id/20.4,s0.5]) sphere(r=2);
translate([-id/2
0.3,id/20.6,s0.5]) sphere(r=2);
translate([id/20.4,id/20.5,s0.5]) sphere(r=2);
translate([id/2
0.5,id/20.2,s0.5]) sphere(r=2);
translate([id/20.2,-id/20.3,s0.5]) sphere(r=2);
translate([-id/2
0.6,id/2*-0.3,s*0.5]) sphere(r=2);
}


How can I manage to get a valid array of coordinates which are all
within a defined circle with a diameter of n?

Many thanks in advance
Karl

P.S.
the goal is to print a kind of lid for different sizes of glasses... to
use them as vase for small flowers.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

This line of code replaces your six lines to make the spheres: for (angle = [0:60:300]) { rotate([0, 0, angle]) translate([-id/2*0.7,0, 0.5*s]) sphere(2);} [image: image.png] On Tue, Jul 16, 2024 at 9:18 AM Karl Exler via Discuss < discuss@lists.openscad.org> wrote: > Dear all > > ...... this is the way a non programmer works.. but it is painful. :-( > > > ---------------------------------------------------------------------------- > > include <bosl2/std.scad> > > > $fn=100; > id=55; //Innendurchmesser > od=64; //Außendurchmesser > h=10; //Höhe über Alles > s=2; //Stärke > > translate([0,0,h/2+s/2]) > tube(h=h-s, or=id/2, wall=s); > difference() > > { > cylinder(s,d=od); > translate([-id/2*0.7,id/2*0.4,s*0.5]) sphere(r=2); > translate([-id/2*0.3,id/2*0.6,s*0.5]) sphere(r=2); > translate([id/2*0.4,id/2*0.5,s*0.5]) sphere(r=2); > translate([id/2*0.5,id/2*0.2,s*0.5]) sphere(r=2); > translate([id/2*0.2,-id/2*0.3,s*0.5]) sphere(r=2); > translate([-id/2*0.6,id/2*-0.3,s*0.5]) sphere(r=2); > } > > ------------------------------------------- > > How can I manage to get a valid array of coordinates which are all > within a defined circle with a diameter of n? > > Many thanks in advance > Karl > > > P.S. > the goal is to print a kind of lid for different sizes of glasses... to > use them as vase for small flowers. > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
PK
Peter Kriens
Tue, Jul 16, 2024 9:03 AM

I see you use BOSL2. Library is quite amazing. Spent the last 4 days trying to get my head around it and I feel I am barely touching the surface.

However, if you are you looking for a grid:

grid_copies(10, inside=circle(100)) cyl(d=5,h=1);

Or just along the edge?

arc_copies(d=100,n=40) circle(3);

if you just want the vectors:

path=arc(n=4,d=100,angle=360);
echo(path);

ECHO: [[50, 0], [-25, 43.3013], [-25, -43.3013], [50, 0]]

On 16 Jul 2024, at 10:18, Karl Exler via Discuss discuss@lists.openscad.org wrote:

Dear all

...... this is the way a non programmer works.. but it is painful. :-(


include <bosl2/std.scad>

$fn=100;
id=55; //Innendurchmesser
od=64; //Außendurchmesser
h=10;  //Höhe über Alles
s=2;  //Stärke

translate([0,0,h/2+s/2])
tube(h=h-s, or=id/2, wall=s);
difference()

{
cylinder(s,d=od);
translate([-id/20.7,id/20.4,s0.5]) sphere(r=2);
translate([-id/2
0.3,id/20.6,s0.5]) sphere(r=2);
translate([id/20.4,id/20.5,s0.5]) sphere(r=2);
translate([id/2
0.5,id/20.2,s0.5]) sphere(r=2);
translate([id/20.2,-id/20.3,s0.5]) sphere(r=2);
translate([-id/2
0.6,id/2*-0.3,s*0.5]) sphere(r=2);
}


How can I manage to get a valid array of coordinates which are all within a defined circle with a diameter of n?

Many thanks in advance
Karl

P.S.
the goal is to print a kind of lid for different sizes of glasses... to use them as vase for small flowers.

<PXL_20240715_100200132.MP.jpg>_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

I see you use BOSL2. Library is quite amazing. Spent the last 4 days trying to get my head around it and I feel I am barely touching the surface. However, if you are you looking for a grid: grid_copies(10, inside=circle(100)) cyl(d=5,h=1);  Or just along the edge? arc_copies(d=100,n=40) circle(3);  if you just want the vectors: path=arc(n=4,d=100,angle=360); echo(path); > ECHO: [[50, 0], [-25, 43.3013], [-25, -43.3013], [50, 0]] > On 16 Jul 2024, at 10:18, Karl Exler via Discuss <discuss@lists.openscad.org> wrote: > > Dear all > > ...... this is the way a non programmer works.. but it is painful. :-( > > ---------------------------------------------------------------------------- > > include <bosl2/std.scad> > > > $fn=100; > id=55; //Innendurchmesser > od=64; //Außendurchmesser > h=10; //Höhe über Alles > s=2; //Stärke > > translate([0,0,h/2+s/2]) > tube(h=h-s, or=id/2, wall=s); > difference() > > { > cylinder(s,d=od); > translate([-id/2*0.7,id/2*0.4,s*0.5]) sphere(r=2); > translate([-id/2*0.3,id/2*0.6,s*0.5]) sphere(r=2); > translate([id/2*0.4,id/2*0.5,s*0.5]) sphere(r=2); > translate([id/2*0.5,id/2*0.2,s*0.5]) sphere(r=2); > translate([id/2*0.2,-id/2*0.3,s*0.5]) sphere(r=2); > translate([-id/2*0.6,id/2*-0.3,s*0.5]) sphere(r=2); > } > > ------------------------------------------- > > How can I manage to get a valid array of coordinates which are all within a defined circle with a diameter of n? > > Many thanks in advance > Karl > > > P.S. > the goal is to print a kind of lid for different sizes of glasses... to use them as vase for small flowers. > > <PXL_20240715_100200132.MP.jpg>_______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
AM
Adrian Mariano
Tue, Jul 16, 2024 1:10 PM

Do you want a set of random points?  I wonder also if you should be using
cylinder instead of sphere to make the holes.

On Tue, Jul 16, 2024 at 08:39 Peter Kriens via Discuss <
discuss@lists.openscad.org> wrote:

I see you use BOSL2. Library is quite amazing. Spent the last 4 days
trying to get my head around it and I feel I am barely touching the surface.

However, if you are you looking for a grid:

grid_copies(10, inside=circle(100)) cyl(d=5,h=1);

[image: PastedGraphic-1.png]

Or just along the edge?

arc_copies(d=100,n=40) circle(3);

[image: PastedGraphic-2.png]

if you just want the vectors:

path=arc(n=4,d=100,angle=360);
echo(path);

ECHO: [[50, 0], [-25, 43.3013], [-25, -43.3013], [50, 0]]

On 16 Jul 2024, at 10:18, Karl Exler via Discuss <
discuss@lists.openscad.org> wrote:

Dear all

...... this is the way a non programmer works.. but it is painful. :-(


include <bosl2/std.scad>

$fn=100;
id=55; //Innendurchmesser
od=64; //Außendurchmesser
h=10;  //Höhe über Alles
s=2;  //Stärke

translate([0,0,h/2+s/2])
tube(h=h-s, or=id/2, wall=s);
difference()

{
cylinder(s,d=od);
translate([-id/20.7,id/20.4,s0.5]) sphere(r=2);
translate([-id/2
0.3,id/20.6,s0.5]) sphere(r=2);
translate([id/20.4,id/20.5,s0.5]) sphere(r=2);
translate([id/2
0.5,id/20.2,s0.5]) sphere(r=2);
translate([id/20.2,-id/20.3,s0.5]) sphere(r=2);
translate([-id/2
0.6,id/2*-0.3,s*0.5]) sphere(r=2);
}


How can I manage to get a valid array of coordinates which are all within
a defined circle with a diameter of n?

Many thanks in advance
Karl

P.S.
the goal is to print a kind of lid for different sizes of glasses... to
use them as vase for small flowers.

<PXL_20240715_100200132.MP.jpg>


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Do you want a set of random points? I wonder also if you should be using cylinder instead of sphere to make the holes. On Tue, Jul 16, 2024 at 08:39 Peter Kriens via Discuss < discuss@lists.openscad.org> wrote: > I see you use BOSL2. Library is quite amazing. Spent the last 4 days > trying to get my head around it and I feel I am barely touching the surface. > > However, if you are you looking for a grid: > > grid_copies(10, inside=circle(100)) cyl(d=5,h=1); > > [image: PastedGraphic-1.png] > > Or just along the edge? > > arc_copies(d=100,n=40) circle(3); > > > [image: PastedGraphic-2.png] > > if you just want the vectors: > > path=arc(n=4,d=100,angle=360); > echo(path); > > > ECHO: [[50, 0], [-25, 43.3013], [-25, -43.3013], [50, 0]] > > > > On 16 Jul 2024, at 10:18, Karl Exler via Discuss < > discuss@lists.openscad.org> wrote: > > Dear all > > ...... this is the way a non programmer works.. but it is painful. :-( > > > ---------------------------------------------------------------------------- > > include <bosl2/std.scad> > > > $fn=100; > id=55; //Innendurchmesser > od=64; //Außendurchmesser > h=10; //Höhe über Alles > s=2; //Stärke > > translate([0,0,h/2+s/2]) > tube(h=h-s, or=id/2, wall=s); > difference() > > { > cylinder(s,d=od); > translate([-id/2*0.7,id/2*0.4,s*0.5]) sphere(r=2); > translate([-id/2*0.3,id/2*0.6,s*0.5]) sphere(r=2); > translate([id/2*0.4,id/2*0.5,s*0.5]) sphere(r=2); > translate([id/2*0.5,id/2*0.2,s*0.5]) sphere(r=2); > translate([id/2*0.2,-id/2*0.3,s*0.5]) sphere(r=2); > translate([-id/2*0.6,id/2*-0.3,s*0.5]) sphere(r=2); > } > > ------------------------------------------- > > How can I manage to get a valid array of coordinates which are all within > a defined circle with a diameter of n? > > Many thanks in advance > Karl > > > P.S. > the goal is to print a kind of lid for different sizes of glasses... to > use them as vase for small flowers. > > <PXL_20240715_100200132.MP.jpg> > _______________________________________________ > > > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
KE
Karl Exler
Thu, Jul 18, 2024 5:09 AM

Hi Peter,

THIS is my favorite.... but I have a problem, as in these coordinates
the z-Achse is missing. So If I want to operate next with something like

path=arc(n=6,d=100,angle=360);

... it returns an array with x and y

/BUT to continue with /

for(i=[0:nz-1])

translate([path[i],0])

  echo(path[i],0);
  cylinder(d=2);

I need an array with a Z-Axis, too...

I receive an failure in "translate"

So my question is: How can I use the result from the path-Variable in
the first line?

Many thanks
Karl

if you just want the vectors:

 echo(path);

ECHO: [[50, 0], [-25, 43.3013], [-25, -43.3013], [50, 0]]

On 16 Jul 2024, at 10:18, Karl Exler via Discuss
discuss@lists.openscad.org wrote:

Dear all

...... this is the way a non programmer works.. but it is painful. :-(


include <bosl2/std.scad>

$fn=100;
id=55; //Innendurchmesser
od=64; //Außendurchmesser
h=10;  //Höhe über Alles
s=2;   //Stärke

translate([0,0,h/2+s/2])
tube(h=h-s, or=id/2, wall=s);
difference()

{
cylinder(s,d=od);
    translate([-id/20.7,id/20.4,s0.5]) sphere(r=2);
    translate([-id/2
0.3,id/20.6,s0.5]) sphere(r=2);
    translate([id/20.4,id/20.5,s0.5]) sphere(r=2);
    translate([id/2
0.5,id/20.2,s0.5]) sphere(r=2);
    translate([id/20.2,-id/20.3,s0.5]) sphere(r=2);
    translate([-id/2
0.6,id/2*-0.3,s*0.5]) sphere(r=2);
}


How can I manage to get a valid array of coordinates which are all
within a defined circle with a diameter of n?

Many thanks in advance
Karl

P.S.
the goal is to print a kind of lid for different sizes of glasses...
to use them as vase for small flowers.

<PXL_20240715_100200132.MP.jpg>_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Hi Peter, THIS is my favorite.... but I have a problem, as in these coordinates the z-Achse is missing. So If I want to operate next with something like *path=arc(n=6,d=100,angle=360);* ... it returns an array with x and y /*BUT* to continue with / for(i=[0:nz-1]) translate([path[i],0])   echo(path[i],0);   cylinder(d=2); I need an array with a Z-Axis, too... I receive an failure in "translate" So my question is: How can I use the result from the path-Variable in the first line? Many thanks Karl if you just want the vectors: > > > echo(path); > > > ECHO: [[50, 0], [-25, 43.3013], [-25, -43.3013], [50, 0]] > > > >> On 16 Jul 2024, at 10:18, Karl Exler via Discuss >> <discuss@lists.openscad.org> wrote: >> >> Dear all >> >> ...... this is the way a non programmer works.. but it is painful. :-( >> >> ---------------------------------------------------------------------------- >> >> include <bosl2/std.scad> >> >> >> $fn=100; >> id=55; //Innendurchmesser >> od=64; //Außendurchmesser >> h=10;  //Höhe über Alles >> s=2;   //Stärke >> >> translate([0,0,h/2+s/2]) >> tube(h=h-s, or=id/2, wall=s); >> difference() >> >> { >> cylinder(s,d=od); >>     translate([-id/2*0.7,id/2*0.4,s*0.5]) sphere(r=2); >>     translate([-id/2*0.3,id/2*0.6,s*0.5]) sphere(r=2); >>     translate([id/2*0.4,id/2*0.5,s*0.5]) sphere(r=2); >>     translate([id/2*0.5,id/2*0.2,s*0.5]) sphere(r=2); >>     translate([id/2*0.2,-id/2*0.3,s*0.5]) sphere(r=2); >>     translate([-id/2*0.6,id/2*-0.3,s*0.5]) sphere(r=2); >> } >> >> ------------------------------------------- >> >> How can I manage to get a valid array of coordinates which are all >> within a defined circle with a diameter of n? >> >> Many thanks in advance >> Karl >> >> >> P.S. >> the goal is to print a kind of lid for different sizes of glasses... >> to use them as vase for small flowers. >> >> <PXL_20240715_100200132.MP.jpg>_______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >
RD
Revar Desmera
Thu, Jul 18, 2024 10:19 AM

In BOSL2, to convert a path from XY 2D, to XYZ 3D, use p3d = path3d(p2d);.

-Revar

On Jul 17, 2024, at 10:10 PM, Karl Exler via Discuss <discuss@lists.openscad.org> wrote:

  Hi Peter,

THIS is my favorite.... but I have a problem, as in these coordinates the z-Achse is missing. So If I want to operate next with something like
path=arc(n=6,d=100,angle=360);

... it returns an array with x and y

BUT to continue with

for(i=[0:nz-1])

translate([path[i],0])

echo(path[i],0);
cylinder(d=2);

I need an array with a Z-Axis, too...

I receive an failure in "translate"

So my question is: How can I use the result from the path-Variable in the first line?

Many thanks
Karl

if you just want the vectors:

echo(path);

> ECHO: [[50, 0], [-25, 43.3013], [-25, -43.3013], [50, 0]]

On 16 Jul 2024, at 10:18, Karl Exler via Discuss <discuss@lists.openscad.org> wrote:

Dear all

...... this is the way a non programmer works.. but it is painful. :-(


include <bosl2/std.scad>

$fn=100;
id=55; //Innendurchmesser
od=64; //Außendurchmesser
h=10; //Höhe über Alles
s=2; //Stärke

translate([0,0,h/2+s/2])
tube(h=h-s, or=id/2, wall=s);
difference()

{
cylinder(s,d=od);
translate([-id/20.7,id/20.4,s0.5]) sphere(r=2);
translate([-id/2
0.3,id/20.6,s0.5]) sphere(r=2);
translate([id/20.4,id/20.5,s0.5]) sphere(r=2);
translate([id/2
0.5,id/20.2,s0.5]) sphere(r=2);
translate([id/20.2,-id/20.3,s0.5]) sphere(r=2);
translate([-id/2
0.6,id/2*-0.3,s*0.5]) sphere(r=2);
}


How can I manage to get a valid array of coordinates which are all within a defined circle with a diameter of n?

Many thanks in advance
Karl

P.S.
the goal is to print a kind of lid for different sizes of glasses... to use them as vase for small flowers.

<PXL_20240715_100200132.MP.jpg>_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

KE
Karl Exler
Thu, Jul 18, 2024 3:04 PM

Thanks you all for your help, but I can't  find a solution.. I always
receive an error message

include <bosl2/std.scad>

$fn=100;
id=55; //Innendurchmesser
od=64; //Außendurchmesser
h=10;  //Höhe über Alles
s=2;   //Stärke
nz=6;  //Anzahl kleine Löcher

path=arc(6,55,360);
newpath = path3d(path);

for(i=[0:4])

  echo (i)
  echo(newpath[i]);
  translate([newpath[i]]) cylinder(h=2,d=2);

yours Karl

Am 18.07.24 um 12:19 schrieb Revar Desmera:

In BOSL2, to convert a path from XY 2D, to XYZ 3D, use p3d = path3d(p2d);.

-Revar

On Jul 17, 2024, at 10:10 PM, Karl Exler via Discuss
discuss@lists.openscad.org wrote:

 Hi Peter,

THIS is my favorite.... but I have a problem, as in these coordinates
the z-Achse is missing. So If I want to operate next with something like

path=arc(n=6,d=100,angle=360);

... it returns an array with x and y

/BUT to continue with /

for(i=[0:nz-1])

translate([path[i],0])

  echo(path[i],0);
  cylinder(d=2);

I need an array with a Z-Axis, too...

I receive an failure in "translate"

So my question is: How can I use the result from the path-Variable in
the first line?

Many thanks
Karl

if you just want the vectors:

 echo(path);

ECHO: [[50, 0], [-25, 43.3013], [-25, -43.3013], [50, 0]]

On 16 Jul 2024, at 10:18, Karl Exler via Discuss
discuss@lists.openscad.org wrote:

Dear all

...... this is the way a non programmer works.. but it is painful. :-(


include <bosl2/std.scad>

$fn=100;
id=55; //Innendurchmesser
od=64; //Außendurchmesser
h=10;  //Höhe über Alles
s=2;   //Stärke

translate([0,0,h/2+s/2])
tube(h=h-s, or=id/2, wall=s);
difference()

{
cylinder(s,d=od);
    translate([-id/20.7,id/20.4,s0.5]) sphere(r=2);
    translate([-id/2
0.3,id/20.6,s0.5]) sphere(r=2);
    translate([id/20.4,id/20.5,s0.5]) sphere(r=2);
    translate([id/2
0.5,id/20.2,s0.5]) sphere(r=2);
    translate([id/20.2,-id/20.3,s0.5]) sphere(r=2);
    translate([-id/2
0.6,id/2*-0.3,s*0.5]) sphere(r=2);
}


How can I manage to get a valid array of coordinates which are all
within a defined circle with a diameter of n?

Many thanks in advance
Karl

P.S.
the goal is to print a kind of lid for different sizes of
glasses... to use them as vase for small flowers.

<PXL_20240715_100200132.MP.jpg>_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Thanks you all for your help, but I can't  find a solution.. I always receive an error message include <bosl2/std.scad> $fn=100; id=55; //Innendurchmesser od=64; //Außendurchmesser h=10;  //Höhe über Alles s=2;   //Stärke nz=6;  //Anzahl kleine Löcher path=arc(6,55,360); newpath = path3d(path); for(i=[0:4])   echo (i)   echo(newpath[i]);   translate([newpath[i]]) cylinder(h=2,d=2); yours Karl Am 18.07.24 um 12:19 schrieb Revar Desmera: > In BOSL2, to convert a path from XY 2D, to XYZ 3D, use `p3d = > path3d(p2d);`. > > -Revar > >> On Jul 17, 2024, at 10:10 PM, Karl Exler via Discuss >> <discuss@lists.openscad.org> wrote: >> >>  Hi Peter, >> >> THIS is my favorite.... but I have a problem, as in these coordinates >> the z-Achse is missing. So If I want to operate next with something like >> >> *path=arc(n=6,d=100,angle=360);* >> >> ... it returns an array with x and y >> >> /*BUT* to continue with / >> >> for(i=[0:nz-1]) >> >> translate([path[i],0]) >> >>   echo(path[i],0); >>   cylinder(d=2); >> >> I need an array with a Z-Axis, too... >> >> >> I receive an failure in "translate" >> >> So my question is: How can I use the result from the path-Variable in >> the first line? >> >> Many thanks >> Karl >> >> >> >> if you just want the vectors: >> >>> >>> >>> echo(path); >>> >>> > ECHO: [[50, 0], [-25, 43.3013], [-25, -43.3013], [50, 0]] >>> >>> >>> >>>> On 16 Jul 2024, at 10:18, Karl Exler via Discuss >>>> <discuss@lists.openscad.org> wrote: >>>> >>>> Dear all >>>> >>>> ...... this is the way a non programmer works.. but it is painful. :-( >>>> >>>> ---------------------------------------------------------------------------- >>>> >>>> include <bosl2/std.scad> >>>> >>>> >>>> $fn=100; >>>> id=55; //Innendurchmesser >>>> od=64; //Außendurchmesser >>>> h=10;  //Höhe über Alles >>>> s=2;   //Stärke >>>> >>>> translate([0,0,h/2+s/2]) >>>> tube(h=h-s, or=id/2, wall=s); >>>> difference() >>>> >>>> { >>>> cylinder(s,d=od); >>>>     translate([-id/2*0.7,id/2*0.4,s*0.5]) sphere(r=2); >>>>     translate([-id/2*0.3,id/2*0.6,s*0.5]) sphere(r=2); >>>>     translate([id/2*0.4,id/2*0.5,s*0.5]) sphere(r=2); >>>>     translate([id/2*0.5,id/2*0.2,s*0.5]) sphere(r=2); >>>>     translate([id/2*0.2,-id/2*0.3,s*0.5]) sphere(r=2); >>>>     translate([-id/2*0.6,id/2*-0.3,s*0.5]) sphere(r=2); >>>> } >>>> >>>> ------------------------------------------- >>>> >>>> How can I manage to get a valid array of coordinates which are all >>>> within a defined circle with a diameter of n? >>>> >>>> Many thanks in advance >>>> Karl >>>> >>>> >>>> P.S. >>>> the goal is to print a kind of lid for different sizes of >>>> glasses... to use them as vase for small flowers. >>>> >>>> <PXL_20240715_100200132.MP.jpg>_______________________________________________ >>>> OpenSCAD mailing list >>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org
JB
Jon Bondy
Thu, Jul 18, 2024 3:50 PM

Maybe missing curly brackets after the for() statement?

On 7/18/2024 11:04 AM, Karl Exler via Discuss wrote:

Thanks you all for your help, but I can't  find a solution.. I always
receive an error message

include <bosl2/std.scad>

$fn=100;
id=55; //Innendurchmesser
od=64; //Außendurchmesser
h=10;  //Höhe über Alles
s=2;   //Stärke
nz=6;  //Anzahl kleine Löcher

path=arc(6,55,360);
newpath = path3d(path);

for(i=[0:4])

  echo (i)
  echo(newpath[i]);
  translate([newpath[i]]) cylinder(h=2,d=2);

yours Karl

Am 18.07.24 um 12:19 schrieb Revar Desmera:

In BOSL2, to convert a path from XY 2D, to XYZ 3D, use p3d = path3d(p2d);.

-Revar

On Jul 17, 2024, at 10:10 PM, Karl Exler via Discuss
discuss@lists.openscad.org wrote:

 Hi Peter,

THIS is my favorite.... but I have a problem, as in these
coordinates the z-Achse is missing. So If I want to operate next
with something like

path=arc(n=6,d=100,angle=360);

... it returns an array with x and y

/BUT to continue with /

for(i=[0:nz-1])

translate([path[i],0])

  echo(path[i],0);
  cylinder(d=2);

I need an array with a Z-Axis, too...

I receive an failure in "translate"

So my question is: How can I use the result from the path-Variable
in the first line?

Many thanks
Karl

if you just want the vectors:

 echo(path);

ECHO: [[50, 0], [-25, 43.3013], [-25, -43.3013], [50, 0]]

On 16 Jul 2024, at 10:18, Karl Exler via Discuss
discuss@lists.openscad.org wrote:

Dear all

...... this is the way a non programmer works.. but it is painful. :-(


include <bosl2/std.scad>

$fn=100;
id=55; //Innendurchmesser
od=64; //Außendurchmesser
h=10;  //Höhe über Alles
s=2;   //Stärke

translate([0,0,h/2+s/2])
tube(h=h-s, or=id/2, wall=s);
difference()

{
cylinder(s,d=od);
    translate([-id/20.7,id/20.4,s0.5]) sphere(r=2);
    translate([-id/2
0.3,id/20.6,s0.5]) sphere(r=2);
    translate([id/20.4,id/20.5,s0.5]) sphere(r=2);
    translate([id/2
0.5,id/20.2,s0.5]) sphere(r=2);
    translate([id/20.2,-id/20.3,s0.5]) sphere(r=2);
    translate([-id/2
0.6,id/2*-0.3,s*0.5]) sphere(r=2);
}


How can I manage to get a valid array of coordinates which are all
within a defined circle with a diameter of n?

Many thanks in advance
Karl

P.S.
the goal is to print a kind of lid for different sizes of
glasses... to use them as vase for small flowers.

<PXL_20240715_100200132.MP.jpg>_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email todiscuss-leave@lists.openscad.org

--
This email has been checked for viruses by AVG antivirus software.
www.avg.com

Maybe missing curly brackets after the for() statement? On 7/18/2024 11:04 AM, Karl Exler via Discuss wrote: > > Thanks you all for your help, but I can't  find a solution.. I always > receive an error message > > include <bosl2/std.scad> > > > $fn=100; > id=55; //Innendurchmesser > od=64; //Außendurchmesser > h=10;  //Höhe über Alles > s=2;   //Stärke > nz=6;  //Anzahl kleine Löcher > > > > path=arc(6,55,360); > newpath = path3d(path); > > for(i=[0:4]) > >   echo (i) >   echo(newpath[i]); >   translate([newpath[i]]) cylinder(h=2,d=2); > > > yours Karl > > Am 18.07.24 um 12:19 schrieb Revar Desmera: >> In BOSL2, to convert a path from XY 2D, to XYZ 3D, use `p3d = >> path3d(p2d);`. >> >> -Revar >> >>> On Jul 17, 2024, at 10:10 PM, Karl Exler via Discuss >>> <discuss@lists.openscad.org> wrote: >>> >>>  Hi Peter, >>> >>> THIS is my favorite.... but I have a problem, as in these >>> coordinates the z-Achse is missing. So If I want to operate next >>> with something like >>> >>> *path=arc(n=6,d=100,angle=360);* >>> >>> ... it returns an array with x and y >>> >>> /*BUT* to continue with / >>> >>> for(i=[0:nz-1]) >>> >>> translate([path[i],0]) >>> >>>   echo(path[i],0); >>>   cylinder(d=2); >>> >>> I need an array with a Z-Axis, too... >>> >>> >>> I receive an failure in "translate" >>> >>> So my question is: How can I use the result from the path-Variable >>> in the first line? >>> >>> Many thanks >>> Karl >>> >>> >>> >>> if you just want the vectors: >>> >>>> >>>> >>>> echo(path); >>>> >>>> > ECHO: [[50, 0], [-25, 43.3013], [-25, -43.3013], [50, 0]] >>>> >>>> >>>> >>>>> On 16 Jul 2024, at 10:18, Karl Exler via Discuss >>>>> <discuss@lists.openscad.org> wrote: >>>>> >>>>> Dear all >>>>> >>>>> ...... this is the way a non programmer works.. but it is painful. :-( >>>>> >>>>> ---------------------------------------------------------------------------- >>>>> >>>>> include <bosl2/std.scad> >>>>> >>>>> >>>>> $fn=100; >>>>> id=55; //Innendurchmesser >>>>> od=64; //Außendurchmesser >>>>> h=10;  //Höhe über Alles >>>>> s=2;   //Stärke >>>>> >>>>> translate([0,0,h/2+s/2]) >>>>> tube(h=h-s, or=id/2, wall=s); >>>>> difference() >>>>> >>>>> { >>>>> cylinder(s,d=od); >>>>>     translate([-id/2*0.7,id/2*0.4,s*0.5]) sphere(r=2); >>>>>     translate([-id/2*0.3,id/2*0.6,s*0.5]) sphere(r=2); >>>>>     translate([id/2*0.4,id/2*0.5,s*0.5]) sphere(r=2); >>>>>     translate([id/2*0.5,id/2*0.2,s*0.5]) sphere(r=2); >>>>>     translate([id/2*0.2,-id/2*0.3,s*0.5]) sphere(r=2); >>>>>     translate([-id/2*0.6,id/2*-0.3,s*0.5]) sphere(r=2); >>>>> } >>>>> >>>>> ------------------------------------------- >>>>> >>>>> How can I manage to get a valid array of coordinates which are all >>>>> within a defined circle with a diameter of n? >>>>> >>>>> Many thanks in advance >>>>> Karl >>>>> >>>>> >>>>> P.S. >>>>> the goal is to print a kind of lid for different sizes of >>>>> glasses... to use them as vase for small flowers. >>>>> >>>>> <PXL_20240715_100200132.MP.jpg>_______________________________________________ >>>>> OpenSCAD mailing list >>>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>>> >>> _______________________________________________ >>> OpenSCAD mailing list >>> To unsubscribe send an email to discuss-leave@lists.openscad.org > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email todiscuss-leave@lists.openscad.org -- This email has been checked for viruses by AVG antivirus software. www.avg.com
KE
Karl Exler
Thu, Jul 18, 2024 4:02 PM

I managed at least using a funny function from BOSL2 ;-) ---> but I am
not convinced from the  randomize results.
Thanks to all for your help
Karl

include <bosl2/std.scad>

$fn=100;
id=55; //Innendurchmesser
od=64; //Außendurchmesser
h=10;  //Höhe über Alles
s=2;   //Stärke
kl=10;  //Anzahl kleine Löcher
ml=5;   //Anzahl mittelgroße Löcher
gl=3;   //Anzahl große Löcher

kpoints = spherical_random_points(kl,id/20.8);*
kp=path2d(kpoints);

mpoints = spherical_random_points(ml,id/2*0.8);
mp=path2d(mpoints);

gpoints = spherical_random_points(gl,id/2*0.8);
gp=path2d(gpoints);

difference()

{
translate([0,0,2])
union()
    {
    translate([0,0,h/2+s/2])
    tube(h=h-s, or=id/2, wall=s);
    cylinder(s,d=od);
    }

for(i=[0:kl-1])
   translate(kp[i]) cylinder(h=6,d=2);

for(i=[0:ml-1])
   translate(mp[i]) cylinder(h=6,d=3.5);

for(i=[0:gl-1])
   translate(gp[i]) cylinder(h=6,d=5);
}

I managed at least using a funny function from BOSL2 ;-) ---> but I am not convinced from the  randomize results. Thanks to all for your help Karl include <bosl2/std.scad> $fn=100; id=55; //Innendurchmesser od=64; //Außendurchmesser h=10;  //Höhe über Alles s=2;   //Stärke kl=10;  //Anzahl kleine Löcher ml=5;   //Anzahl mittelgroße Löcher gl=3;   //Anzahl große Löcher kpoints = *spherical_random_points(kl,id/2*0.8);* kp=*path2d(kpoints);* mpoints = spherical_random_points(ml,id/2*0.8); mp=path2d(mpoints); gpoints = spherical_random_points(gl,id/2*0.8); gp=path2d(gpoints); difference() { translate([0,0,2]) union()     {     translate([0,0,h/2+s/2])     tube(h=h-s, or=id/2, wall=s);     cylinder(s,d=od);     } for(i=[0:kl-1])    translate(kp[i]) cylinder(h=6,d=2); for(i=[0:ml-1])    translate(mp[i]) cylinder(h=6,d=3.5); for(i=[0:gl-1])    translate(gp[i]) cylinder(h=6,d=5); }
SP
Sanjeev Prabhakar
Thu, Jul 18, 2024 4:02 PM

I dont know about BOSL
but there are some syntax error which I can see and corrected below
Please check if this works

path=arc(6,55,360);
newpath = path3d(path);

for(i=[0:4])
{
echo (i);
echo(newpath[i]);
translate([newpath[i]]) cylinder(h=2,d=2);
}

On Thu, 18 Jul 2024 at 20:35, Karl Exler via Discuss <
discuss@lists.openscad.org> wrote:

Thanks you all for your help, but I can't  find a solution.. I always
receive an error message

include <bosl2/std.scad>

$fn=100;
id=55; //Innendurchmesser
od=64; //Außendurchmesser
h=10;  //Höhe über Alles
s=2;  //Stärke
nz=6;  //Anzahl kleine Löcher

path=arc(6,55,360);
newpath = path3d(path);

for(i=[0:4])

echo (i)
echo(newpath[i]);
translate([newpath[i]]) cylinder(h=2,d=2);

yours Karl
Am 18.07.24 um 12:19 schrieb Revar Desmera:

In BOSL2, to convert a path from XY 2D, to XYZ 3D, use p3d = path3d(p2d);.

-Revar

On Jul 17, 2024, at 10:10 PM, Karl Exler via Discuss
discuss@lists.openscad.org discuss@lists.openscad.org wrote:

 Hi Peter,

THIS is my favorite.... but I have a problem, as in these coordinates the
z-Achse is missing. So If I want to operate next with something like

path=arc(n=6,d=100,angle=360);

... it returns an array with x and y

*BUT to continue with *

for(i=[0:nz-1])

translate([path[i],0])

echo(path[i],0);
cylinder(d=2);

I need an array with a Z-Axis, too...

I receive an failure in "translate"

So my question is: How can I use the result from the path-Variable in the
first line?

Many thanks
Karl

if you just want the vectors:

echo(path);

ECHO: [[50, 0], [-25, 43.3013], [-25, -43.3013], [50, 0]]

On 16 Jul 2024, at 10:18, Karl Exler via Discuss
discuss@lists.openscad.org discuss@lists.openscad.org wrote:

Dear all

...... this is the way a non programmer works.. but it is painful. :-(


include <bosl2/std.scad>

$fn=100;
id=55; //Innendurchmesser
od=64; //Außendurchmesser
h=10;  //Höhe über Alles
s=2;  //Stärke

translate([0,0,h/2+s/2])
tube(h=h-s, or=id/2, wall=s);
difference()

{
cylinder(s,d=od);
translate([-id/20.7,id/20.4,s0.5]) sphere(r=2);
translate([-id/2
0.3,id/20.6,s0.5]) sphere(r=2);
translate([id/20.4,id/20.5,s0.5]) sphere(r=2);
translate([id/2
0.5,id/20.2,s0.5]) sphere(r=2);
translate([id/20.2,-id/20.3,s0.5]) sphere(r=2);
translate([-id/2
0.6,id/2*-0.3,s*0.5]) sphere(r=2);
}


How can I manage to get a valid array of coordinates which are all within
a defined circle with a diameter of n?

Many thanks in advance
Karl

P.S.
the goal is to print a kind of lid for different sizes of glasses... to
use them as vase for small flowers.

<PXL_20240715_100200132.MP.jpg>


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

I dont know about BOSL but there are some syntax error which I can see and corrected below Please check if this works path=arc(6,55,360); newpath = path3d(path); for(i=[0:4]) { echo (i); echo(newpath[i]); translate([newpath[i]]) cylinder(h=2,d=2); } On Thu, 18 Jul 2024 at 20:35, Karl Exler via Discuss < discuss@lists.openscad.org> wrote: > Thanks you all for your help, but I can't find a solution.. I always > receive an error message > > include <bosl2/std.scad> > > > $fn=100; > id=55; //Innendurchmesser > od=64; //Außendurchmesser > h=10; //Höhe über Alles > s=2; //Stärke > nz=6; //Anzahl kleine Löcher > > > > path=arc(6,55,360); > newpath = path3d(path); > > for(i=[0:4]) > > echo (i) > echo(newpath[i]); > translate([newpath[i]]) cylinder(h=2,d=2); > > > yours Karl > Am 18.07.24 um 12:19 schrieb Revar Desmera: > > In BOSL2, to convert a path from XY 2D, to XYZ 3D, use `p3d = > path3d(p2d);`. > > -Revar > > On Jul 17, 2024, at 10:10 PM, Karl Exler via Discuss > <discuss@lists.openscad.org> <discuss@lists.openscad.org> wrote: > >  Hi Peter, > > THIS is my favorite.... but I have a problem, as in these coordinates the > z-Achse is missing. So If I want to operate next with something like > > *path=arc(n=6,d=100,angle=360);* > > ... it returns an array with x and y > > *BUT to continue with * > > for(i=[0:nz-1]) > > translate([path[i],0]) > > echo(path[i],0); > cylinder(d=2); > > I need an array with a Z-Axis, too... > > > I receive an failure in "translate" > > So my question is: How can I use the result from the path-Variable in the > first line? > > Many thanks > Karl > > > > if you just want the vectors: > > > > echo(path); > > > ECHO: [[50, 0], [-25, 43.3013], [-25, -43.3013], [50, 0]] > > > > On 16 Jul 2024, at 10:18, Karl Exler via Discuss > <discuss@lists.openscad.org> <discuss@lists.openscad.org> wrote: > > Dear all > > ...... this is the way a non programmer works.. but it is painful. :-( > > > ---------------------------------------------------------------------------- > > include <bosl2/std.scad> > > > $fn=100; > id=55; //Innendurchmesser > od=64; //Außendurchmesser > h=10; //Höhe über Alles > s=2; //Stärke > > translate([0,0,h/2+s/2]) > tube(h=h-s, or=id/2, wall=s); > difference() > > { > cylinder(s,d=od); > translate([-id/2*0.7,id/2*0.4,s*0.5]) sphere(r=2); > translate([-id/2*0.3,id/2*0.6,s*0.5]) sphere(r=2); > translate([id/2*0.4,id/2*0.5,s*0.5]) sphere(r=2); > translate([id/2*0.5,id/2*0.2,s*0.5]) sphere(r=2); > translate([id/2*0.2,-id/2*0.3,s*0.5]) sphere(r=2); > translate([-id/2*0.6,id/2*-0.3,s*0.5]) sphere(r=2); > } > > ------------------------------------------- > > How can I manage to get a valid array of coordinates which are all within > a defined circle with a diameter of n? > > Many thanks in advance > Karl > > > P.S. > the goal is to print a kind of lid for different sizes of glasses... to > use them as vase for small flowers. > > <PXL_20240715_100200132.MP.jpg> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >