If i want to place 4 pieces of something (e.g a cylinder) in a square
A=-4,0
B=4,0
C=4,6
D=-4,6
How can I put those 4 coordinates into a "for-loop" ? Can I define those
for as an array, which is operated one by one?
Many thanks
Karl
You could do the following:
for(coord = [[-4,0], [4,0], [4,6], [-4,6]]) translate(coord)
Personally, I would be more likely to do something like:
for(x = [-4, 4], y = [0, 6]) translate([x, y])
On Apr 7, 2023 at 00:47 -0700, Karl Exler karl.exler@meinklang.cc, wrote:
If i want to place 4 pieces of something (e.g a cylinder) in a square
A=-4,0
B=4,0
C=4,6
D=-4,6
How can I put those 4 coordinates into a "for-loop" ? Can I define those
for as an array, which is operated one by one?
Many thanks
Karl
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
Those are only ordinates, not coordinates.
Assuming the first two are x and the second two y,
for(x = [A, B], y = [C, D]) translate([x,y]) cylinder();
On Fri, 7 Apr 2023 at 08:47, Karl Exler karl.exler@meinklang.cc wrote:
If i want to place 4 pieces of something (e.g a cylinder) in a square
A=-4,0
B=4,0
C=4,6
D=-4,6
How can I put those 4 coordinates into a "for-loop" ? Can I define those
for as an array, which is operated one by one?
Many thanks
Karl
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
I assume what he meant was:
A=[-4,0]
B=[4,0]
C=[4,6]
D=[-4,6]
On Apr 7, 2023 at 00:54 -0700, nop head nop.head@gmail.com, wrote:
Those are only ordinates, not coordinates.
Assuming the first two are x and the second two y,
for(x = [A, B], y = [C, D]) translate([x,y]) cylinder();
On Fri, 7 Apr 2023 at 08:47, Karl Exler karl.exler@meinklang.cc wrote:
If i want to place 4 pieces of something (e.g a cylinder) in a square
A=-4,0
B=4,0
C=4,6
D=-4,6
How can I put those 4 coordinates into a "for-loop" ? Can I define those
for as an array, which is operated one by one?
Many thanks
Karl
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
This is simple
A=[-4,0];
B=[4,0];
C=[4,6];
D=[-4,6];
for(i=[A,B,C,D])translate(i)cylinder();
On Fri, 7 Apr 2023 at 13:16, Karl Exler karl.exler@meinklang.cc wrote:
If i want to place 4 pieces of something (e.g a cylinder) in a square
A=-4,0
B=4,0
C=4,6
D=-4,6
How can I put those 4 coordinates into a "for-loop" ? Can I define those
for as an array, which is operated one by one?
Many thanks
Karl
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
Must be going blind I read the commas as points. My excuse is I am in Spain
ATM, where they do use commas as points.
On Fri, 7 Apr 2023 at 09:00, Sanjeev Prabhakar sprabhakar2006@gmail.com
wrote:
This is simple
A=[-4,0];
B=[4,0];
C=[4,6];
D=[-4,6];
for(i=[A,B,C,D])translate(i)cylinder();
On Fri, 7 Apr 2023 at 13:16, Karl Exler karl.exler@meinklang.cc wrote:
If i want to place 4 pieces of something (e.g a cylinder) in a square
A=-4,0
B=4,0
C=4,6
D=-4,6
How can I put those 4 coordinates into a "for-loop" ? Can I define those
for as an array, which is operated one by one?
Many thanks
Karl
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
😂
On Fri, 7 Apr, 2023, 1:40 pm nop head, nop.head@gmail.com wrote:
Must be going blind I read the commas as points. My excuse is I am in
Spain ATM, where they do use commas as points.
On Fri, 7 Apr 2023 at 09:00, Sanjeev Prabhakar sprabhakar2006@gmail.com
wrote:
This is simple
A=[-4,0];
B=[4,0];
C=[4,6];
D=[-4,6];
for(i=[A,B,C,D])translate(i)cylinder();
On Fri, 7 Apr 2023 at 13:16, Karl Exler karl.exler@meinklang.cc wrote:
If i want to place 4 pieces of something (e.g a cylinder) in a square
A=-4,0
B=4,0
C=4,6
D=-4,6
How can I put those 4 coordinates into a "for-loop" ? Can I define those
for as an array, which is operated one by one?
Many thanks
Karl
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
both solutions are great. Many many thanks!
Karl
Am 7. April 2023 09:59:19 MESZ schrieb Sanjeev Prabhakar sprabhakar2006@gmail.com:
This is simple
A=[-4,0];
B=[4,0];
C=[4,6];
D=[-4,6];
for(i=[A,B,C,D])translate(i)cylinder();
On Fri, 7 Apr 2023 at 13:16, Karl Exler karl.exler@meinklang.cc wrote:
If i want to place 4 pieces of something (e.g a cylinder) in a square
A=-4,0
B=4,0
C=4,6
D=-4,6
How can I put those 4 coordinates into a "for-loop" ? Can I define those
for as an array, which is operated one by one?
Many thanks
Karl
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
--
Diese Nachricht wurde von unterwegs gesendet...
I am a bit proud about this solution marked in red ;-)
Karl
include <bosl2/std.scad>
$fn=100;
L=175;
H=45;
f=1.08;
f2=0.7;
A=[-L/2f2,-L/2f2,Hf];
B=[L/2f2,-L/2f2,Hf];
C=[L/2f2,L/2f2,Hf];
D=[-L/2f2,L/2f2,Hf];
u=32;
w=[-u,-u];
x=[-u,u,0];
y=[u,-u];
z=[u,u];
j=[0,0];
schale();
zw();
module schale()
{
for(a=[j,w,x,y,z]) translate(a) color ("red") cylinder(h=7,r1=4,r2=6,$fn=4);
//prismoid(30,20 , rounding=1, h=5
translate([0,0,-6.8])
difference()
   {
       union()
       {
           rotate([0,0,-45])
           resize([L,L,H])
           rotate_extrude($fn=4)
           translate([-35.8,0,0])
           import("anpflanzschale.svg");
           for(i=[A,B,C,D]) translate(i) cylinder(r=4,h=3.3);
       }
   for(i=[A,B,C,D]) translate(i) cylinder(r=0.9,h=5.3);
   }
}
module zw()
{
ydistribute(spacing=30){
   color("green") Zwischenwand();
   color("green") Zwischenwand();
   color("green") Zwischenwand();
   }
 xdistribute(spacing=30){
   color("blue") rotate([0,0,90]) Zwischenwand();
   color("blue") rotate([0,0,90]) Zwischenwand();
   color("blue") rotate([0,0,90]) Zwischenwand();
   }
 }
module Zwischenwand()
  {
   rot([180,0,0], cp=[0,0,12]) prismoid(size1=[110,1.8],
size2=[103,1.5], h=30,center=true);
   };
//