discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

How to generate random cubes within the domain of circle radius

R
rasunag27
Tue, Jan 5, 2021 6:06 AM

Yes..I will work without "let".

Since I tried to reinstall Openscad. As I am working in ubuntu, it is taking
the version of 2015.03 - 1 only. It is not updating.

Thanks and Regards,

Sunag R A.

--
Sent from: http://forum.openscad.org/

Yes..I will work without "let". Since I tried to reinstall Openscad. As I am working in ubuntu, it is taking the version of 2015.03 - 1 only. It is not updating. Thanks and Regards, Sunag R A. -- Sent from: http://forum.openscad.org/
R
rasunag27
Tue, Jan 5, 2021 6:09 AM

The code:

linear_extrude(size) {
for ([0:499]) {
a = rands(0, 360, 1)[0];
translate(pos(radius, size) * [sin(a), cos(a)])
square(size, center = true);
}
}

is working fine. Now I can build upon this on what I needed other than cube.

Thank you so much everyone.

Regards,
Sunag R A.

--
Sent from: http://forum.openscad.org/

The code: linear_extrude(size) { for ([0:499]) { a = rands(0, 360, 1)[0]; translate(pos(radius, size) * [sin(a), cos(a)]) square(size, center = true); } } is working fine. Now I can build upon this on what I needed other than cube. Thank you so much everyone. Regards, Sunag R A. -- Sent from: http://forum.openscad.org/
BL
Bryan Lee
Tue, Jan 5, 2021 7:00 AM

Thus rasunag27 hast written on Mon, Jan 04, 2021 at 11:06:32PM -0700, and, according to prophecy, it shall come to pass that:

Since I tried to reinstall Openscad. As I am working in ubuntu, it is taking
the version of 2015.03 - 1 only. It is not updating.

Ubuntu 18.04.5 LTS
You can install the snap with:
sudo apt update
sudo apt install snapd # If needed
sudo snap install openscad # Version 2019.05
OR
sudo snap install openscad-nightly # Version 2021.01.03

Thus rasunag27 hast written on Mon, Jan 04, 2021 at 11:06:32PM -0700, and, according to prophecy, it shall come to pass that: > > Since I tried to reinstall Openscad. As I am working in ubuntu, it is taking > the version of 2015.03 - 1 only. It is not updating. Ubuntu 18.04.5 LTS You can install the snap with: sudo apt update sudo apt install snapd # If needed sudo snap install openscad # Version 2019.05 OR sudo snap install openscad-nightly # Version 2021.01.03
T
TLC123
Tue, Jan 5, 2021 3:42 PM

translate([0, 0, -0.5])
circle(14, $fn = 50);

for (x = rands(-14, 14, 50), y = rands(-14, 14, 50))
if(norm ([x,y])<14-0.707107*0.5  )  translate([x, y, 0.25]) cube([0.5, 0.5,
0.5],center=true);

--
Sent from: http://forum.openscad.org/

translate([0, 0, -0.5]) circle(14, $fn = 50); for (x = rands(-14, 14, 50), y = rands(-14, 14, 50)) if(norm ([x,y])<14-0.707107*0.5 ) translate([x, y, 0.25]) cube([0.5, 0.5, 0.5],center=true); -- Sent from: http://forum.openscad.org/